aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-06-30 18:59:55 +0200
committera-kenji <aks.kenji@protonmail.com>2021-06-30 18:59:55 +0200
commit242e41d67f0835f26b8fa0961a50fcbbf0bb2a91 (patch)
treed7334069986b139f253ae877363e9a6d9f0071dd /zellij-utils/src
parentModularize spawn_terminal_function (diff)
parentMerge pull request #591 from a-kenji/update-dependencies (diff)
downloadsl0ppij-242e41d67f0835f26b8fa0961a50fcbbf0bb2a91.tar.gz
sl0ppij-242e41d67f0835f26b8fa0961a50fcbbf0bb2a91.tar.xz
sl0ppij-242e41d67f0835f26b8fa0961a50fcbbf0bb2a91.zip
Merge branch 'main' of https://github.com/zellij-org/zellij into modularize-spawn-terminal
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/consts.rs2
-rw-r--r--zellij-utils/src/input/actions.rs4
-rw-r--r--zellij-utils/src/input/config.rs4
-rw-r--r--zellij-utils/src/input/layout.rs8
-rw-r--r--zellij-utils/src/input/options.rs2
-rw-r--r--zellij-utils/src/ipc.rs2
-rw-r--r--zellij-utils/src/setup.rs20
7 files changed, 21 insertions, 21 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs
index 697e9024..4e6ad9d0 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/actions.rs b/zellij-utils/src/input/actions.rs
index 4e0ce0cb..615df3c4 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use zellij_tile::data::InputMode;
/// The four directions (left, right, up, down).
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Eq, Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum Direction {
Left,
Right,
@@ -17,7 +17,7 @@ pub enum Direction {
// They might need to be adjusted in the default config
// as well `../../../assets/config/default.yaml`
/// Actions that can be bound to keys.
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Eq, Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum Action {
/// Quit Zellij.
Quit,
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs
index 56e333f4..6a65109a 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 f694423a..16309db1 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 88503959..4ebb5b86 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/ipc.rs b/zellij-utils/src/ipc.rs
index 3fd2b243..cf952bdc 100644
--- a/zellij-utils/src/ipc.rs
+++ b/zellij-utils/src/ipc.rs
@@ -35,7 +35,7 @@ pub enum ClientType {
Writer,
}
-#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
+#[derive(Default, Serialize, Deserialize, Debug, Clone, Copy)]
pub struct ClientAttributes {
pub position_and_size: PositionAndSize,
pub palette: Palette,
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs
index de441e0b..f9613c0f 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())?;