diff --git a/src/cmd_line.rs b/src/cmd_line.rs index 9fcd33f..94b94fb 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -310,7 +310,7 @@ mod tests { let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); handle_command_line_arguments(args).expect("Could not parse arguments"); - assert_eq!(SETTINGS.get::().log_to_file, true); + assert!(SETTINGS.get::().log_to_file); } #[test] diff --git a/src/editor/cursor.rs b/src/editor/cursor.rs index 781caa1..31ea8f7 100644 --- a/src/editor/cursor.rs +++ b/src/editor/cursor.rs @@ -84,7 +84,7 @@ impl Cursor { return self .style .as_ref() - .map(|s| (255 as f32 * ((100 - s.blend) as f32 / (100.0 as f32))) as u8) + .map(|s| (255_f32 * ((100 - s.blend) as f32 / 100.0_f32)) as u8) .unwrap_or(255); } @@ -160,7 +160,7 @@ mod tests { cursor.foreground(&DEFAULT_COLORS), DEFAULT_COLORS.background.unwrap() ); - cursor.style = style.clone(); + cursor.style = style; assert_eq!( cursor.foreground(&DEFAULT_COLORS), COLORS.foreground.unwrap() @@ -182,7 +182,7 @@ mod tests { cursor.background(&DEFAULT_COLORS), DEFAULT_COLORS.foreground.unwrap() ); - cursor.style = style.clone(); + cursor.style = style; assert_eq!( cursor.background(&DEFAULT_COLORS), COLORS.background.unwrap() diff --git a/src/editor/grid.rs b/src/editor/grid.rs index d04dc16..4401641 100644 --- a/src/editor/grid.rs +++ b/src/editor/grid.rs @@ -201,7 +201,7 @@ mod tests { character_grid.set_all_characters(grid_cell.clone()); assert_eq!( character_grid.characters, - vec![grid_cell.clone(); context.area] + vec![grid_cell; context.area] ); } @@ -214,7 +214,7 @@ mod tests { "foo".to_string(), Some(Arc::new(Style::new(context.none_colors))), ); - character_grid.characters = vec![grid_cell.clone(); context.area]; + character_grid.characters = vec![grid_cell; context.area]; // RUN FUNCTION character_grid.clear(); diff --git a/src/editor/mod.rs b/src/editor/mod.rs index 65fab92..e75cce8 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -83,7 +83,7 @@ impl Editor { } RedrawEvent::ModeInfoSet { cursor_modes } => { self.mode_list = cursor_modes; - if let Some(current_mode_i) = self.current_mode_index.clone() { + if let Some(current_mode_i) = self.current_mode_index { if let Some(current_mode) = self.mode_list.get(current_mode_i as usize) { self.cursor.change_mode(current_mode, &self.defined_styles) } diff --git a/src/editor/window.rs b/src/editor/window.rs index e4f49e2..43c354e 100644 --- a/src/editor/window.rs +++ b/src/editor/window.rs @@ -367,6 +367,6 @@ mod tests { let sent_commands = draw_command_receiver .try_recv() .expect("Could not receive commands"); - assert!(sent_commands.len() != 0); + assert!(!sent_commands.is_empty()); } } diff --git a/src/main.rs b/src/main.rs index 3934d67..62ac71f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] - // Test naming occasionally uses camelCase with underscores to separate sections of // the test name. -#[cfg_attr(test, allow(non_snake_case))] +#![cfg_attr(test, allow(non_snake_case))] #[macro_use] extern crate neovide_derive; diff --git a/src/renderer/cursor_renderer/mod.rs b/src/renderer/cursor_renderer/mod.rs index d59e23e..6dbb4a4 100644 --- a/src/renderer/cursor_renderer/mod.rs +++ b/src/renderer/cursor_renderer/mod.rs @@ -204,12 +204,12 @@ impl CursorRenderer { } pub fn handle_event(&mut self, event: &Event<()>) { - match event { - Event::WindowEvent { - event: WindowEvent::Focused(is_focused), - .. - } => self.window_has_focus = *is_focused, - _ => {} + if let Event::WindowEvent { + event: WindowEvent::Focused(is_focused), + .. + } = event + { + self.window_has_focus = *is_focused } } @@ -424,7 +424,7 @@ impl CursorRenderer { path.line_to(self.corners[3].current_position); path.close(); - canvas.draw_path(&path, &paint); + canvas.draw_path(&path, paint); path } @@ -459,7 +459,7 @@ impl CursorRenderer { // from the larger one. This can fail in which case we return a full "rectangle". let path = op(&rectangle, &subtract, skia_safe::PathOp::Difference).unwrap_or(rectangle); - canvas.draw_path(&path, &paint); + canvas.draw_path(&path, paint); path } } diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 1b98390..15592a5 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -143,7 +143,7 @@ impl Settings { mod tests { use async_trait::async_trait; use nvim_rs::{Handler, Neovim}; - use tokio; + use super::*; use crate::{ @@ -224,8 +224,8 @@ mod tests { let vt2 = TypeId::of::(); let mut values = settings.settings.write(); - values.insert(vt1, Box::new(v1.clone())); - values.insert(vt2, Box::new(v2.clone())); + values.insert(vt1, Box::new(v1)); + values.insert(vt2, Box::new(v2)); unsafe { settings.settings.force_unlock_write();