diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-06-29 23:02:51 +0200 |
---|---|---|
committer | a-kenji <aks.kenji@protonmail.com> | 2021-06-29 23:02:51 +0200 |
commit | b3b9175081d6e7df02872bff8d530623b8c046f9 (patch) | |
tree | e4de583f6a1eaaf8d00a88727a3c0e1b55993c9e /zellij-utils | |
parent | 3313634fe969a69925a5d32445ba14a5f79e5d87 (diff) |
chore(clippy): needless_borrow
Diffstat (limited to 'zellij-utils')
-rw-r--r-- | zellij-utils/src/consts.rs | 2 | ||||
-rw-r--r-- | zellij-utils/src/input/config.rs | 4 | ||||
-rw-r--r-- | zellij-utils/src/input/layout.rs | 8 | ||||
-rw-r--r-- | zellij-utils/src/input/options.rs | 2 | ||||
-rw-r--r-- | zellij-utils/src/setup.rs | 20 |
5 files changed, 18 insertions, 18 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 697e9024d..4e6ad9d0f 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -20,7 +20,7 @@ const fn system_default_data_dir() -> &'static str { if let Some(data_dir) = std::option_env!("PREFIX") { data_dir } else { - &"/usr" + "/usr" } } diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 56e333f46..6a65109a7 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -66,7 +66,7 @@ impl TryFrom<&CliArgs> for Config { fn try_from(opts: &CliArgs) -> ConfigResult { if let Some(ref path) = opts.config { - return Config::new(&path); + return Config::new(path); } if let Some(Command::Setup(ref setup)) = opts.command { @@ -96,7 +96,7 @@ impl TryFrom<&CliArgs> for Config { impl Config { /// Uses defaults, but lets config override them. pub fn from_yaml(yaml_config: &str) -> ConfigResult { - let config_from_yaml: ConfigFromYaml = serde_yaml::from_str(&yaml_config)?; + let config_from_yaml: ConfigFromYaml = serde_yaml::from_str(yaml_config)?; let keybinds = Keybinds::get_default_keybinds_with_config(config_from_yaml.keybinds); let options = Options::from_yaml(config_from_yaml.options); let themes = config_from_yaml.themes; diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index f694423a2..16309db1d 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -69,8 +69,8 @@ impl Layout { layout_dir: Option<PathBuf>, ) -> Option<Layout> { let layout_result = layout - .map(|p| Layout::from_dir(&p, layout_dir.as_ref())) - .or_else(|| layout_path.map(|p| Layout::new(&p))) + .map(|p| Layout::from_dir(p, layout_dir.as_ref())) + .or_else(|| layout_path.map(|p| Layout::new(p))) .or_else(|| { Some(Layout::from_dir( &std::path::PathBuf::from("default"), @@ -138,7 +138,7 @@ impl Layout { &self, space: &PositionAndSize, ) -> Vec<(Layout, PositionAndSize)> { - split_space(space, &self) + split_space(space, self) } } @@ -286,7 +286,7 @@ fn split_space( for (i, part) in layout.parts.iter().enumerate() { let part_position_and_size = split_parts.get(i).unwrap(); if !part.parts.is_empty() { - let mut part_positions = split_space(&part_position_and_size, part); + let mut part_positions = split_space(part_position_and_size, part); pane_positions.append(&mut part_positions); } else { pane_positions.push((part.clone(), *part_position_and_size)); diff --git a/zellij-utils/src/input/options.rs b/zellij-utils/src/input/options.rs index 885039594..4ebb5b86d 100644 --- a/zellij-utils/src/input/options.rs +++ b/zellij-utils/src/input/options.rs @@ -70,7 +70,7 @@ impl Options { pub fn from_cli(&self, other: Option<Command>) -> Options { if let Some(Command::Options(options)) = other { - Options::merge(&self, options) + Options::merge(self, options) } else { self.to_owned() } diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index de441e0b2..f9613c0f4 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -71,7 +71,7 @@ pub fn get_layout_dir(config_dir: Option<PathBuf>) -> Option<PathBuf> { } pub fn dump_asset(asset: &[u8]) -> std::io::Result<()> { - std::io::stdout().write_all(&asset)?; + std::io::stdout().write_all(asset)?; Ok(()) } @@ -134,7 +134,7 @@ impl Setup { } if self.check { - Setup::check_defaults_config(&opts)?; + Setup::check_defaults_config(opts)?; std::process::exit(0); } @@ -163,14 +163,14 @@ impl Setup { if let Some(config_dir) = config_dir { message.push_str(&format!("[CONFIG DIR]: {:?}\n", config_dir)); } else { - message.push_str(&"[CONFIG DIR]: Not Found\n"); + message.push_str("[CONFIG DIR]: Not Found\n"); let mut default_config_dirs = default_config_dirs() .iter() .filter_map(|p| p.clone()) .collect::<Vec<PathBuf>>(); default_config_dirs.dedup(); message.push_str( - &" On your system zellij looks in the following config directories by default:\n", + " On your system zellij looks in the following config directories by default:\n", ); for dir in default_config_dirs { message.push_str(&format!(" {:?}\n", dir)); @@ -180,11 +180,11 @@ impl Setup { use crate::input::config::Config; message.push_str(&format!("[CONFIG FILE]: {:?}\n", config_file)); match Config::new(&config_file) { - Ok(_) => message.push_str(&"[CONFIG FILE]: Well defined.\n"), + Ok(_) => message.push_str("[CONFIG FILE]: Well defined.\n"), Err(e) => message.push_str(&format!("[CONFIG ERROR]: {}\n", e)), } } else { - message.push_str(&"[CONFIG FILE]: Not Found\n"); + message.push_str("[CONFIG FILE]: Not Found\n"); message.push_str(&format!( " By default zellij looks for a file called [{}] in the configuration directory\n", CONFIG_NAME @@ -196,12 +196,12 @@ impl Setup { message.push_str(&format!("[SYSTEM DATA DIR]: {:?}\n", system_data_dir)); message.push_str(&format!("[ARROW SEPARATOR]: {}\n", ARROW_SEPARATOR)); - message.push_str(&" Is the [ARROW_SEPARATOR] displayed correctly?\n"); - message.push_str(&" If not you may want to either start zellij with a compatible mode 'zellij options --simplified-ui'\n"); - message.push_str(&" Or check the font that is in use:\n https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly\n"); + message.push_str(" Is the [ARROW_SEPARATOR] displayed correctly?\n"); + message.push_str(" If not you may want to either start zellij with a compatible mode 'zellij options --simplified-ui'\n"); + message.push_str(" Or check the font that is in use:\n https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly\n"); message.push_str(&format!("[FEATURES]: {:?}\n", FEATURES)); - message.push_str(&"[DOCUMENTATION]: zellij.dev/documentation/\n"); + message.push_str("[DOCUMENTATION]: zellij.dev/documentation/\n"); std::io::stdout().write_all(message.as_bytes())?; |