diff options
author | Paulo Coelho <9609090+prscoelho@users.noreply.github.com> | 2021-09-09 09:24:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 10:24:03 +0200 |
commit | 6d0c5a56f54eb3f47991cc2743587103cffc123c (patch) | |
tree | f827b819cbf2b3c0b50899b1a2aabdf8b714efe7 /zellij-utils | |
parent | 0f0122fb596e336d36dad04e390273dd3f3f430d (diff) |
style(clippy): various fixes (#704)
* test: fix clippy unused_io_amount
* chore(clippy): various clippy fixes
needless_borrow, let_and_return, vec_init_then_push, unit_arg,
useless_format, field_reassign_with_default, redundant_clone
Diffstat (limited to 'zellij-utils')
-rw-r--r-- | zellij-utils/src/input/config.rs | 18 | ||||
-rw-r--r-- | zellij-utils/src/input/unit/keybinds_test.rs | 6 |
2 files changed, 14 insertions, 10 deletions
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 930fe07af..8bee3d0a0 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -275,8 +275,10 @@ mod config_test { #[test] fn try_from_cli_args_with_config() { let arbitrary_config = PathBuf::from("nonexistent.yaml"); - let mut opts = CliArgs::default(); - opts.config = Some(arbitrary_config); + let opts = CliArgs { + config: Some(arbitrary_config), + ..Default::default() + }; println!("OPTS= {:?}", opts); let result = Config::try_from(&opts); assert!(result.is_err()); @@ -285,11 +287,13 @@ mod config_test { #[test] fn try_from_cli_args_with_option_clean() { use crate::setup::Setup; - let mut opts = CliArgs::default(); - opts.command = Some(Command::Setup(Setup { - clean: true, - ..Setup::default() - })); + let opts = CliArgs { + command: Some(Command::Setup(Setup { + clean: true, + ..Setup::default() + })), + ..Default::default() + }; let result = Config::try_from(&opts); assert!(result.is_ok()); } diff --git a/zellij-utils/src/input/unit/keybinds_test.rs b/zellij-utils/src/input/unit/keybinds_test.rs index e8a776d76..6800bdf59 100644 --- a/zellij-utils/src/input/unit/keybinds_test.rs +++ b/zellij-utils/src/input/unit/keybinds_test.rs @@ -92,7 +92,7 @@ fn merge_keybinds_overwrites_same_keys() { let mut keybinds_self = Keybinds::new(); keybinds_self .0 - .insert(InputMode::Normal, mode_keybinds_self.clone()); + .insert(InputMode::Normal, mode_keybinds_self); let mut keybinds_other = Keybinds::new(); keybinds_other .0 @@ -152,7 +152,7 @@ fn no_unbind_unbinds_none() { fn last_keybind_is_taken() { let actions_1 = vec![Action::NoOp, Action::NewTab(None)]; let keyaction_1 = KeyActionFromYaml { - action: actions_1.clone(), + action: actions_1, key: vec![Key::F(1), Key::Backspace, Key::Char('t')], }; let actions_2 = vec![Action::GoToTab(1)]; @@ -184,7 +184,7 @@ fn last_keybind_overwrites() { let mut expected = ModeKeybinds::new(); expected.0.insert(Key::F(1), actions_2.clone()); - expected.0.insert(Key::Backspace, actions_1.clone()); + expected.0.insert(Key::Backspace, actions_1); expected.0.insert(Key::Char('t'), actions_2); assert_eq!(expected, ModeKeybinds::from(vec![keyaction_1, keyaction_2])); |