rust/rhg/src/commands/root.rs
changeset 45438 ed95ccc94333
parent 45363 5dbf875b3275
child 45984 fada33872b5b
--- a/rust/rhg/src/commands/root.rs	Mon Aug 03 11:55:59 2020 +0200
+++ b/rust/rhg/src/commands/root.rs	Tue Aug 04 16:11:23 2020 +0200
@@ -10,24 +10,22 @@
 Returns 0 on success.
 ";
 
-pub struct RootCommand<'a> {
-    ui: &'a Ui,
-}
+pub struct RootCommand {}
 
-impl<'a> RootCommand<'a> {
-    pub fn new(ui: &'a Ui) -> Self {
-        RootCommand { ui }
+impl RootCommand {
+    pub fn new() -> Self {
+        RootCommand {}
     }
 }
 
-impl<'a> Command<'a> for RootCommand<'a> {
-    fn run(&self) -> Result<(), CommandError> {
+impl Command for RootCommand {
+    fn run(&self, ui: &Ui) -> Result<(), CommandError> {
         let path_buf = FindRoot::new().run()?;
 
         let bytes = get_bytes_from_path(path_buf);
 
         // TODO use formating macro
-        self.ui.write_stdout(&[bytes.as_slice(), b"\n"].concat())?;
+        ui.write_stdout(&[bytes.as_slice(), b"\n"].concat())?;
 
         Ok(())
     }