From 6666a88cc503eccd4000d994a74f04eb1e35ab2d Mon Sep 17 00:00:00 2001 From: Awiteb Date: Wed, 24 Apr 2024 23:04:02 +0300 Subject: [PATCH] chore: Change from `&self` to `self` for `RunCommand::run` --- src/cli/add_command.rs | 2 +- src/cli/clean_command.rs | 2 +- src/cli/edit_command.rs | 2 +- src/cli/export_command.rs | 2 +- src/cli/gen_command.rs | 2 +- src/cli/import_command.rs | 2 +- src/cli/list_command.rs | 2 +- src/cli/remove_command.rs | 2 +- src/macros.rs | 2 +- src/traits.rs | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cli/add_command.rs b/src/cli/add_command.rs index 25009c6..e5fadd1 100644 --- a/src/cli/add_command.rs +++ b/src/cli/add_command.rs @@ -29,7 +29,7 @@ pub struct Add { } impl RunCommand for Add { - fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { if self.vault_info.username.is_none() && self.vault_info.password.is_none() && self.vault_info.service.is_none() diff --git a/src/cli/clean_command.rs b/src/cli/clean_command.rs index 2efeed3..11ae7ec 100644 --- a/src/cli/clean_command.rs +++ b/src/cli/clean_command.rs @@ -28,7 +28,7 @@ use crate::{ pub struct Clean {} impl RunCommand for Clean { - fn run(&self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { fs::write(vault_manager.vaults_file, "[]").map_err(LprsError::Io) } } diff --git a/src/cli/edit_command.rs b/src/cli/edit_command.rs index a7d393d..7c05b8e 100644 --- a/src/cli/edit_command.rs +++ b/src/cli/edit_command.rs @@ -47,7 +47,7 @@ pub struct Edit { } impl RunCommand for Edit { - fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { let index = self.index.get() as usize; if let Some(vault) = vault_manager.vaults.get_mut(index - 1) { diff --git a/src/cli/export_command.rs b/src/cli/export_command.rs index 1375ebb..34b7abf 100644 --- a/src/cli/export_command.rs +++ b/src/cli/export_command.rs @@ -34,7 +34,7 @@ pub struct Export { } impl RunCommand for Export { - fn run(&self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { if self .path .extension() diff --git a/src/cli/gen_command.rs b/src/cli/gen_command.rs index d5dacac..f35f92f 100644 --- a/src/cli/gen_command.rs +++ b/src/cli/gen_command.rs @@ -45,7 +45,7 @@ pub struct Gen { } impl RunCommand for Gen { - fn run(&self, _vault_manager: Vaults) -> LprsResult<()> { + fn run(self, _vault_manager: Vaults) -> LprsResult<()> { if self.uppercase || self.lowercase || self.numbers || self.symbols { println!( "{}", diff --git a/src/cli/import_command.rs b/src/cli/import_command.rs index cbc080a..2168ba3 100644 --- a/src/cli/import_command.rs +++ b/src/cli/import_command.rs @@ -35,7 +35,7 @@ pub struct Import { } impl RunCommand for Import { - fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { if self.path.exists() { if self .path diff --git a/src/cli/list_command.rs b/src/cli/list_command.rs index c26483c..16cfc63 100644 --- a/src/cli/list_command.rs +++ b/src/cli/list_command.rs @@ -50,7 +50,7 @@ pub struct List { } impl RunCommand for List { - fn run(&self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { if vault_manager.vaults.is_empty() { return Err(LprsError::Other( "Looks like there is no passwords to list".to_owned(), diff --git a/src/cli/remove_command.rs b/src/cli/remove_command.rs index 29ac6b6..36e8ebb 100644 --- a/src/cli/remove_command.rs +++ b/src/cli/remove_command.rs @@ -35,7 +35,7 @@ pub struct Remove { } impl RunCommand for Remove { - fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { let index = (self.index.get() - 1) as usize; if index > vault_manager.vaults.len() { if !self.force { diff --git a/src/macros.rs b/src/macros.rs index 454b8ed..a753c97 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -63,7 +63,7 @@ macro_rules! create_commands { #[automatically_derived] impl $crate::RunCommand for $enum_name{ - fn run(&self, vault_manager: $crate::vault::Vaults<$crate::vault::vault_state::Plain>) -> $crate::LprsResult<()> { + fn run(self, vault_manager: $crate::vault::Vaults<$crate::vault::vault_state::Plain>) -> $crate::LprsResult<()> { match self { $( Self::$varint(command) => command.run(vault_manager), diff --git a/src/traits.rs b/src/traits.rs index dd8e9c4..cb0882c 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -21,5 +21,5 @@ use crate::{ /// Trait to run the command pub trait RunCommand { - fn run(&self, vault_manager: Vaults) -> LprsResult<()>; + fn run(self, vault_manager: Vaults) -> LprsResult<()>; }