From 372f759ca467e47c373a086c6a247c150b87d4bc Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:50:54 +0000 Subject: [PATCH] chore: Rust 1.81.0 linting --- src/input_handler/mod.rs | 5 +++-- src/main.rs | 3 ++- src/ui/draw_blocks.rs | 6 ++++-- src/ui/mod.rs | 3 +-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index 3110596..5ea42ee 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -513,12 +513,13 @@ impl InputHandler { MouseEventKind::ScrollUp => self.previous(), MouseEventKind::ScrollDown => self.next(), MouseEventKind::Down(MouseButton::Left) => { - if let Some(header) = self.gui_state.lock().header_intersect(Rect::new( + let header = self.gui_state.lock().header_intersect(Rect::new( mouse_event.column, mouse_event.row, 1, 1, - )) { + )); + if let Some(header) = header { self.sort(header); } diff --git a/src/main.rs b/src/main.rs index aa5c2cd..42b7da9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,7 +139,8 @@ async fn main() { info!("in debug mode\n"); // Debug mode for testing, less pointless now, will display some basic information while is_running.load(Ordering::SeqCst) { - if let Some(err) = app_data.lock().get_error() { + let err = app_data.lock().get_error(); + if let Some(err) = err { error!("{}", err); process::exit(1); } diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 5a8c3eb..243dcd8 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -294,7 +294,8 @@ pub fn ports( app_data: &Arc>, max_lens: (usize, usize, usize), ) { - if let Some(ports) = app_data.lock().get_selected_ports() { + let ports = app_data.lock().get_selected_ports(); + if let Some(ports) = ports { let block = Block::default() .borders(Borders::ALL) .border_type(BorderType::Rounded) @@ -344,7 +345,8 @@ pub fn ports( /// Draw the cpu + mem charts pub fn chart(f: &mut Frame, area: Rect, app_data: &Arc>) { - if let Some((cpu, mem)) = app_data.lock().get_chart_data() { + let cpu_mem = app_data.lock().get_chart_data(); + if let Some((cpu, mem)) = cpu_mem { let area = Layout::default() .direction(Direction::Horizontal) .constraints(CONSTRAINT_50_50) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 03b2bec..2158fef 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -114,8 +114,7 @@ impl Ui { )?; disable_raw_mode()?; self.terminal.clear().ok(); - self.terminal - .set_cursor_position(self.cursor_position)?; + self.terminal.set_cursor_position(self.cursor_position)?; Ok(self.terminal.show_cursor()?) }