From b3b9175081d6e7df02872bff8d530623b8c046f9 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Tue, 29 Jun 2021 23:02:51 +0200 Subject: chore(clippy): needless_borrow --- default-plugins/status-bar/src/second_line.rs | 6 +- default-plugins/tab-bar/src/line.rs | 8 +- zellij-client/src/input_handler.rs | 2 +- zellij-client/src/lib.rs | 2 +- zellij-server/src/tab.rs | 114 +++++++++++++------------- zellij-server/src/ui/pane_resizer.rs | 8 +- zellij-utils/src/consts.rs | 2 +- zellij-utils/src/input/config.rs | 4 +- zellij-utils/src/input/layout.rs | 8 +- zellij-utils/src/input/options.rs | 2 +- zellij-utils/src/setup.rs | 20 ++--- 11 files changed, 88 insertions(+), 88 deletions(-) diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 0861c4646..750df77b6 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -292,7 +292,7 @@ fn full_shortcut_list(help: &ModeInfo) -> LinePart { _ => { let mut line_part = LinePart::default(); for (i, (letter, description)) in help.keybinds.iter().enumerate() { - let shortcut = full_length_shortcut(i == 0, &letter, &description, help.palette); + let shortcut = full_length_shortcut(i == 0, letter, description, help.palette); line_part.len += shortcut.len; line_part.part = format!("{}{}", line_part.part, shortcut,); } @@ -311,7 +311,7 @@ fn shortened_shortcut_list(help: &ModeInfo) -> LinePart { _ => { let mut line_part = LinePart::default(); for (i, (letter, description)) in help.keybinds.iter().enumerate() { - let shortcut = first_word_shortcut(i == 0, &letter, &description, help.palette); + let shortcut = first_word_shortcut(i == 0, letter, description, help.palette); line_part.len += shortcut.len; line_part.part = format!("{}{}", line_part.part, shortcut,); } @@ -344,7 +344,7 @@ fn best_effort_shortcut_list(help: &ModeInfo, max_len: usize) -> LinePart { _ => { let mut line_part = LinePart::default(); for (i, (letter, description)) in help.keybinds.iter().enumerate() { - let shortcut = first_word_shortcut(i == 0, &letter, &description, help.palette); + let shortcut = first_word_shortcut(i == 0, letter, description, help.palette); if line_part.len + shortcut.len + MORE_MSG.chars().count() > max_len { // TODO: better line_part.part = format!("{}{}", line_part.part, MORE_MSG); diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index fce8982da..cad5b7207 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -21,7 +21,7 @@ fn populate_tabs_in_tab_line( if tabs_before_active.is_empty() && tabs_after_active.is_empty() { break; } - let current_title_len = get_current_title_len(&tabs_to_render); + let current_title_len = get_current_title_len(tabs_to_render); if current_title_len >= cols { break; } @@ -117,7 +117,7 @@ fn add_previous_tabs_msg( palette: Palette, separator: &str, ) { - while get_current_title_len(&tabs_to_render) + while get_current_title_len(tabs_to_render) + left_more_message(tabs_before_active.len(), palette, separator).len >= cols { @@ -134,7 +134,7 @@ fn add_next_tabs_msg( palette: Palette, separator: &str, ) { - while get_current_title_len(&title_bar) + while get_current_title_len(title_bar) + right_more_message(tabs_after_active.len(), palette, separator).len >= cols { @@ -160,7 +160,7 @@ pub fn tab_separator(capabilities: PluginCapabilities) -> &'static str { if !capabilities.arrow_fonts { ARROW_SEPARATOR } else { - &"" + "" } } diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index 65181e512..469249514 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -109,7 +109,7 @@ impl InputHandler { self.dispatch_action(action); } } else { - for action in Keybinds::key_to_actions(&key, raw_bytes, &self.mode, keybinds) { + for action in Keybinds::key_to_actions(key, raw_bytes, &self.mode, keybinds) { let should_exit = self.dispatch_action(action); if should_exit { self.should_exit = true; diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 975100565..5b409e750 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -278,7 +278,7 @@ pub fn start_client( ClientInstruction::Render(output) => { let mut stdout = os_input.get_stdout_writer(); stdout - .write_all(&output.as_bytes()) + .write_all(output.as_bytes()) .expect("cannot write to stdout"); stdout.flush().expect("could not flush"); } diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs index 5ca682b8a..fbcb5ada1 100644 --- a/zellij-server/src/tab.rs +++ b/zellij-server/src/tab.rs @@ -301,7 +301,7 @@ impl Tab { match positions_and_size.next() { Some((_, position_and_size)) => { terminal_pane.reset_size_and_position_override(); - terminal_pane.change_pos_and_size(&position_and_size); + terminal_pane.change_pos_and_size(position_and_size); self.os_api.set_terminal_size_using_fd( *pid, position_and_size.cols as u16, @@ -872,14 +872,14 @@ impl Tab { fn panes_top_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> { self.panes .keys() - .map(|t_id| self.panes.get(&t_id).unwrap().as_ref()) + .map(|t_id| self.panes.get(t_id).unwrap().as_ref()) .filter(|terminal| terminal.pid() != pane.pid() && terminal.y() == pane.y()) .collect() } fn panes_bottom_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> { self.panes .keys() - .map(|t_id| self.panes.get(&t_id).unwrap().as_ref()) + .map(|t_id| self.panes.get(t_id).unwrap().as_ref()) .filter(|terminal| { terminal.pid() != pane.pid() && terminal.y() + terminal.rows() == pane.y() + pane.rows() @@ -889,7 +889,7 @@ impl Tab { fn panes_right_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> { self.panes .keys() - .map(|t_id| self.panes.get(&t_id).unwrap().as_ref()) + .map(|t_id| self.panes.get(t_id).unwrap().as_ref()) .filter(|terminal| { terminal.pid() != pane.pid() && terminal.x() + terminal.columns() == pane.x() + pane.columns() @@ -899,7 +899,7 @@ impl Tab { fn panes_left_aligned_with_pane(&self, pane: &dyn Pane) -> Vec<&dyn Pane> { self.panes .keys() - .map(|t_id| self.panes.get(&t_id).unwrap().as_ref()) + .map(|t_id| self.panes.get(t_id).unwrap().as_ref()) .filter(|terminal| terminal.pid() != pane.pid() && terminal.x() == pane.x()) .collect() } @@ -1350,20 +1350,20 @@ impl Tab { } fn reduce_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) { let mut terminals_below = self - .pane_ids_directly_below(&id) + .pane_ids_directly_below(id) .expect("can't reduce pane size up if there are no terminals below"); let terminal_borders_below: HashSet = terminals_below .iter() .map(|t| self.panes.get(t).unwrap().x()) .collect(); let (left_resize_border, terminals_to_the_left) = - self.bottom_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_below); + self.bottom_aligned_contiguous_panes_to_the_left(id, &terminal_borders_below); let (right_resize_border, terminals_to_the_right) = - self.bottom_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_below); + self.bottom_aligned_contiguous_panes_to_the_right(id, &terminal_borders_below); terminals_below.retain(|t| { self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border) }); - self.reduce_pane_height_up(&id, count); + self.reduce_pane_height_up(id, count); for terminal_id in terminals_below { self.increase_pane_height_up(&terminal_id, count); } @@ -1371,25 +1371,25 @@ impl Tab { .iter() .chain(terminals_to_the_right.iter()) { - self.reduce_pane_height_up(&terminal_id, count); + self.reduce_pane_height_up(terminal_id, count); } } fn reduce_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) { let mut terminals_above = self - .pane_ids_directly_above(&id) + .pane_ids_directly_above(id) .expect("can't reduce pane size down if there are no terminals above"); let terminal_borders_above: HashSet = terminals_above .iter() .map(|t| self.panes.get(t).unwrap().x()) .collect(); let (left_resize_border, terminals_to_the_left) = - self.top_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_above); + self.top_aligned_contiguous_panes_to_the_left(id, &terminal_borders_above); let (right_resize_border, terminals_to_the_right) = - self.top_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_above); + self.top_aligned_contiguous_panes_to_the_right(id, &terminal_borders_above); terminals_above.retain(|t| { self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border) }); - self.reduce_pane_height_down(&id, count); + self.reduce_pane_height_down(id, count); for terminal_id in terminals_above { self.increase_pane_height_down(&terminal_id, count); } @@ -1397,71 +1397,71 @@ impl Tab { .iter() .chain(terminals_to_the_right.iter()) { - self.reduce_pane_height_down(&terminal_id, count); + self.reduce_pane_height_down(terminal_id, count); } } fn reduce_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) { let mut terminals_to_the_left = self - .pane_ids_directly_left_of(&id) + .pane_ids_directly_left_of(id) .expect("can't reduce pane size right if there are no terminals to the left"); let terminal_borders_to_the_left: HashSet = terminals_to_the_left .iter() .map(|t| self.panes.get(t).unwrap().y()) .collect(); let (top_resize_border, terminals_above) = - self.left_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_left); + self.left_aligned_contiguous_panes_above(id, &terminal_borders_to_the_left); let (bottom_resize_border, terminals_below) = - self.left_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_left); + self.left_aligned_contiguous_panes_below(id, &terminal_borders_to_the_left); terminals_to_the_left.retain(|t| { self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border) }); - self.reduce_pane_width_right(&id, count); + self.reduce_pane_width_right(id, count); for terminal_id in terminals_to_the_left { self.increase_pane_width_right(&terminal_id, count); } for terminal_id in terminals_above.iter().chain(terminals_below.iter()) { - self.reduce_pane_width_right(&terminal_id, count); + self.reduce_pane_width_right(terminal_id, count); } } fn reduce_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) { let mut terminals_to_the_right = self - .pane_ids_directly_right_of(&id) + .pane_ids_directly_right_of(id) .expect("can't reduce pane size left if there are no terminals to the right"); let terminal_borders_to_the_right: HashSet = terminals_to_the_right .iter() .map(|t| self.panes.get(t).unwrap().y()) .collect(); let (top_resize_border, terminals_above) = - self.right_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_right); + self.right_aligned_contiguous_panes_above(id, &terminal_borders_to_the_right); let (bottom_resize_border, terminals_below) = - self.right_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_right); + self.right_aligned_contiguous_panes_below(id, &terminal_borders_to_the_right); terminals_to_the_right.retain(|t| { self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border) }); - self.reduce_pane_width_left(&id, count); + self.reduce_pane_width_left(id, count); for terminal_id in terminals_to_the_right { self.increase_pane_width_left(&terminal_id, count); } for terminal_id in terminals_above.iter().chain(terminals_below.iter()) { - self.reduce_pane_width_left(&terminal_id, count); + self.reduce_pane_width_left(terminal_id, count); } } fn increase_pane_and_surroundings_up(&mut self, id: &PaneId, count: usize) { let mut terminals_above = self - .pane_ids_directly_above(&id) + .pane_ids_directly_above(id) .expect("can't increase pane size up if there are no terminals above"); let terminal_borders_above: HashSet = terminals_above .iter() .map(|t| self.panes.get(t).unwrap().x()) .collect(); let (left_resize_border, terminals_to_the_left) = - self.top_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_above); + self.top_aligned_contiguous_panes_to_the_left(id, &terminal_borders_above); let (right_resize_border, terminals_to_the_right) = - self.top_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_above); + self.top_aligned_contiguous_panes_to_the_right(id, &terminal_borders_above); terminals_above.retain(|t| { self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border) }); - self.increase_pane_height_up(&id, count); + self.increase_pane_height_up(id, count); for terminal_id in terminals_above { self.reduce_pane_height_up(&terminal_id, count); } @@ -1469,25 +1469,25 @@ impl Tab { .iter() .chain(terminals_to_the_right.iter()) { - self.increase_pane_height_up(&terminal_id, count); + self.increase_pane_height_up(terminal_id, count); } } fn increase_pane_and_surroundings_down(&mut self, id: &PaneId, count: usize) { let mut terminals_below = self - .pane_ids_directly_below(&id) + .pane_ids_directly_below(id) .expect("can't increase pane size down if there are no terminals below"); let terminal_borders_below: HashSet = terminals_below .iter() .map(|t| self.panes.get(t).unwrap().x()) .collect(); let (left_resize_border, terminals_to_the_left) = - self.bottom_aligned_contiguous_panes_to_the_left(&id, &terminal_borders_below); + self.bottom_aligned_contiguous_panes_to_the_left(id, &terminal_borders_below); let (right_resize_border, terminals_to_the_right) = - self.bottom_aligned_contiguous_panes_to_the_right(&id, &terminal_borders_below); + self.bottom_aligned_contiguous_panes_to_the_right(id, &terminal_borders_below); terminals_below.retain(|t| { self.pane_is_between_vertical_borders(t, left_resize_border, right_resize_border) }); - self.increase_pane_height_down(&id, count); + self.increase_pane_height_down(id, count); for terminal_id in terminals_below { self.reduce_pane_height_down(&terminal_id, count); } @@ -1495,53 +1495,53 @@ impl Tab { .iter() .chain(terminals_to_the_right.iter()) { - self.increase_pane_height_down(&terminal_id, count); + self.increase_pane_height_down(terminal_id, count); } } fn increase_pane_and_surroundings_right(&mut self, id: &PaneId, count: usize) { let mut terminals_to_the_right = self - .pane_ids_directly_right_of(&id) + .pane_ids_directly_right_of(id) .expect("can't increase pane size right if there are no terminals to the right"); let terminal_borders_to_the_right: HashSet = terminals_to_the_right .iter() .map(|t| self.panes.get(t).unwrap().y()) .collect(); let (top_resize_border, terminals_above) = - self.right_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_right); + self.right_aligned_contiguous_panes_above(id, &terminal_borders_to_the_right); let (bottom_resize_border, terminals_below) = - self.right_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_right); + self.right_aligned_contiguous_panes_below(id, &terminal_borders_to_the_right); terminals_to_the_right.retain(|t| { self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border) }); - self.increase_pane_width_right(&id, count); + self.increase_pane_width_right(id, count); for terminal_id in terminals_to_the_right { self.reduce_pane_width_right(&terminal_id, count); } for terminal_id in terminals_above.iter().chain(terminals_below.iter()) { - self.increase_pane_width_right(&terminal_id, count); + self.increase_pane_width_right(terminal_id, count); } } fn increase_pane_and_surroundings_left(&mut self, id: &PaneId, count: usize) { let mut terminals_to_the_left = self - .pane_ids_directly_left_of(&id) + .pane_ids_directly_left_of(id) .expect("can't increase pane size right if there are no terminals to the right"); let terminal_borders_to_the_left: HashSet = terminals_to_the_left .iter() .map(|t| self.panes.get(t).unwrap().y()) .collect(); let (top_resize_border, terminals_above) = - self.left_aligned_contiguous_panes_above(&id, &terminal_borders_to_the_left); + self.left_aligned_contiguous_panes_above(id, &terminal_borders_to_the_left); let (bottom_resize_border, terminals_below) = - self.left_aligned_contiguous_panes_below(&id, &terminal_borders_to_the_left); + self.left_aligned_contiguous_panes_below(id, &terminal_borders_to_the_left); terminals_to_the_left.retain(|t| { self.pane_is_between_horizontal_borders(t, top_resize_border, bottom_resize_border) }); - self.increase_pane_width_left(&id, count); + self.increase_pane_width_left(id, count); for terminal_id in terminals_to_the_left { self.reduce_pane_width_left(&terminal_id, count); } for terminal_id in terminals_above.iter().chain(terminals_below.iter()) { - self.increase_pane_width_left(&terminal_id, count); + self.increase_pane_width_left(terminal_id, count); } } fn can_increase_pane_and_surroundings_right( @@ -1560,7 +1560,7 @@ impl Tab { let mut new_pos_and_size_for_pane = pane.position_and_size(); new_pos_and_size_for_pane.cols += increase_by; - if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(&pane_id) { + if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(pane_id) { return panes_to_the_right.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.columns() > increase_by && p.columns() - increase_by >= p.min_width() @@ -1585,7 +1585,7 @@ impl Tab { let mut new_pos_and_size_for_pane = pane.position_and_size(); new_pos_and_size_for_pane.x = new_pos_and_size_for_pane.x.saturating_sub(increase_by); - if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(&pane_id) { + if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(pane_id) { return panes_to_the_left.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.columns() > increase_by && p.columns() - increase_by >= p.min_width() @@ -1610,7 +1610,7 @@ impl Tab { let mut new_pos_and_size_for_pane = pane.position_and_size(); new_pos_and_size_for_pane.rows += increase_by; - if let Some(panes_below) = self.pane_ids_directly_below(&pane_id) { + if let Some(panes_below) = self.pane_ids_directly_below(pane_id) { return panes_below.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.rows() > increase_by && p.rows() - increase_by >= p.min_height() @@ -1631,7 +1631,7 @@ impl Tab { let mut new_pos_and_size_for_pane = pane.position_and_size(); new_pos_and_size_for_pane.y = new_pos_and_size_for_pane.y.saturating_sub(increase_by); - if let Some(panes_above) = self.pane_ids_directly_above(&pane_id) { + if let Some(panes_above) = self.pane_ids_directly_above(pane_id) { return panes_above.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.rows() > increase_by && p.rows() - increase_by >= p.min_height() @@ -1648,7 +1648,7 @@ impl Tab { if !can_reduce_pane_size { return false; } - if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(&pane_id) { + if let Some(panes_to_the_left) = self.pane_ids_directly_left_of(pane_id) { return panes_to_the_left.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.max_width() @@ -1667,7 +1667,7 @@ impl Tab { if !can_reduce_pane_size { return false; } - if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(&pane_id) { + if let Some(panes_to_the_right) = self.pane_ids_directly_right_of(pane_id) { return panes_to_the_right.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.max_width() @@ -1686,7 +1686,7 @@ impl Tab { if !can_reduce_pane_size { return false; } - if let Some(panes_above) = self.pane_ids_directly_above(&pane_id) { + if let Some(panes_above) = self.pane_ids_directly_above(pane_id) { return panes_above.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.max_height() @@ -1705,7 +1705,7 @@ impl Tab { if !can_reduce_pane_size { return false; } - if let Some(panes_below) = self.pane_ids_directly_below(&pane_id) { + if let Some(panes_below) = self.pane_ids_directly_below(pane_id) { return panes_below.iter().all(|id| { let p = self.panes.get(id).unwrap(); p.max_height() @@ -2147,7 +2147,7 @@ impl Tab { pane.can_increase_width_by(pane_to_close_width + 1) }) { for pane_id in panes.iter() { - self.increase_pane_width_right(&pane_id, pane_to_close_width + 1); + self.increase_pane_width_right(pane_id, pane_to_close_width + 1); // 1 for the border } self.panes.remove(&id); @@ -2163,7 +2163,7 @@ impl Tab { pane.can_increase_width_by(pane_to_close_width + 1) }) { for pane_id in panes.iter() { - self.increase_pane_width_left(&pane_id, pane_to_close_width + 1); + self.increase_pane_width_left(pane_id, pane_to_close_width + 1); // 1 for the border } self.panes.remove(&id); @@ -2179,7 +2179,7 @@ impl Tab { pane.can_increase_height_by(pane_to_close_height + 1) }) { for pane_id in panes.iter() { - self.increase_pane_height_down(&pane_id, pane_to_close_height + 1); + self.increase_pane_height_down(pane_id, pane_to_close_height + 1); // 1 for the border } self.panes.remove(&id); @@ -2195,7 +2195,7 @@ impl Tab { pane.can_increase_height_by(pane_to_close_height + 1) }) { for pane_id in panes.iter() { - self.increase_pane_height_up(&pane_id, pane_to_close_height + 1); + self.increase_pane_height_up(pane_id, pane_to_close_height + 1); // 1 for the border } self.panes.remove(&id); diff --git a/zellij-server/src/ui/pane_resizer.rs b/zellij-server/src/ui/pane_resizer.rs index 5ab065481..39f2d40c6 100644 --- a/zellij-server/src/ui/pane_resizer.rs +++ b/zellij-server/src/ui/pane_resizer.rs @@ -33,7 +33,7 @@ impl<'a> PaneResizer<'a> { Ordering::Greater => { let increase_by = new_size.cols - current_size.cols; if let Some(panes_to_resize) = find_increasable_vertical_chain( - &self.panes, + self.panes, increase_by, current_size.cols, current_size.rows, @@ -50,7 +50,7 @@ impl<'a> PaneResizer<'a> { Ordering::Less => { let reduce_by = current_size.cols - new_size.cols; if let Some(panes_to_resize) = find_reducible_vertical_chain( - &self.panes, + self.panes, reduce_by, current_size.cols, current_size.rows, @@ -67,7 +67,7 @@ impl<'a> PaneResizer<'a> { Ordering::Greater => { let increase_by = new_size.rows - current_size.rows; if let Some(panes_to_resize) = find_increasable_horizontal_chain( - &self.panes, + self.panes, increase_by, current_size.cols, current_size.rows, @@ -81,7 +81,7 @@ impl<'a> PaneResizer<'a> { Ordering::Less => { let reduce_by = current_size.rows - new_size.rows; if let Some(panes_to_resize) = find_reducible_horizontal_chain( - &self.panes, + self.panes, reduce_by, current_size.cols, current_size.rows, 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, ) -> Option { 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) -> 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) -> Option { } 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::>(); 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())?; -- cgit v1.2.3