fix clippy warnings

macos-click-through
Jaffar Mohammed 2 years ago
parent 9b8907c8c7
commit 5752025762

@ -310,7 +310,7 @@ mod tests {
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
handle_command_line_arguments(args).expect("Could not parse arguments"); handle_command_line_arguments(args).expect("Could not parse arguments");
assert_eq!(SETTINGS.get::<CmdLineSettings>().log_to_file, true); assert!(SETTINGS.get::<CmdLineSettings>().log_to_file);
} }
#[test] #[test]

@ -84,7 +84,7 @@ impl Cursor {
return self return self
.style .style
.as_ref() .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); .unwrap_or(255);
} }
@ -160,7 +160,7 @@ mod tests {
cursor.foreground(&DEFAULT_COLORS), cursor.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.background.unwrap() DEFAULT_COLORS.background.unwrap()
); );
cursor.style = style.clone(); cursor.style = style;
assert_eq!( assert_eq!(
cursor.foreground(&DEFAULT_COLORS), cursor.foreground(&DEFAULT_COLORS),
COLORS.foreground.unwrap() COLORS.foreground.unwrap()
@ -182,7 +182,7 @@ mod tests {
cursor.background(&DEFAULT_COLORS), cursor.background(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.unwrap() DEFAULT_COLORS.foreground.unwrap()
); );
cursor.style = style.clone(); cursor.style = style;
assert_eq!( assert_eq!(
cursor.background(&DEFAULT_COLORS), cursor.background(&DEFAULT_COLORS),
COLORS.background.unwrap() COLORS.background.unwrap()

@ -201,7 +201,7 @@ mod tests {
character_grid.set_all_characters(grid_cell.clone()); character_grid.set_all_characters(grid_cell.clone());
assert_eq!( assert_eq!(
character_grid.characters, character_grid.characters,
vec![grid_cell.clone(); context.area] vec![grid_cell; context.area]
); );
} }
@ -214,7 +214,7 @@ mod tests {
"foo".to_string(), "foo".to_string(),
Some(Arc::new(Style::new(context.none_colors))), 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 // RUN FUNCTION
character_grid.clear(); character_grid.clear();

@ -83,7 +83,7 @@ impl Editor {
} }
RedrawEvent::ModeInfoSet { cursor_modes } => { RedrawEvent::ModeInfoSet { cursor_modes } => {
self.mode_list = 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) { if let Some(current_mode) = self.mode_list.get(current_mode_i as usize) {
self.cursor.change_mode(current_mode, &self.defined_styles) self.cursor.change_mode(current_mode, &self.defined_styles)
} }

@ -367,6 +367,6 @@ mod tests {
let sent_commands = draw_command_receiver let sent_commands = draw_command_receiver
.try_recv() .try_recv()
.expect("Could not receive commands"); .expect("Could not receive commands");
assert!(sent_commands.len() != 0); assert!(!sent_commands.is_empty());
} }
} }

@ -1,8 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// Test naming occasionally uses camelCase with underscores to separate sections of // Test naming occasionally uses camelCase with underscores to separate sections of
// the test name. // the test name.
#[cfg_attr(test, allow(non_snake_case))] #![cfg_attr(test, allow(non_snake_case))]
#[macro_use] #[macro_use]
extern crate neovide_derive; extern crate neovide_derive;

@ -204,12 +204,12 @@ impl CursorRenderer {
} }
pub fn handle_event(&mut self, event: &Event<()>) { pub fn handle_event(&mut self, event: &Event<()>) {
match event { if let Event::WindowEvent {
Event::WindowEvent { event: WindowEvent::Focused(is_focused),
event: WindowEvent::Focused(is_focused), ..
.. } = event
} => self.window_has_focus = *is_focused, {
_ => {} self.window_has_focus = *is_focused
} }
} }
@ -424,7 +424,7 @@ impl CursorRenderer {
path.line_to(self.corners[3].current_position); path.line_to(self.corners[3].current_position);
path.close(); path.close();
canvas.draw_path(&path, &paint); canvas.draw_path(&path, paint);
path path
} }
@ -459,7 +459,7 @@ impl CursorRenderer {
// from the larger one. This can fail in which case we return a full "rectangle". // 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); let path = op(&rectangle, &subtract, skia_safe::PathOp::Difference).unwrap_or(rectangle);
canvas.draw_path(&path, &paint); canvas.draw_path(&path, paint);
path path
} }
} }

@ -143,7 +143,7 @@ impl Settings {
mod tests { mod tests {
use async_trait::async_trait; use async_trait::async_trait;
use nvim_rs::{Handler, Neovim}; use nvim_rs::{Handler, Neovim};
use tokio;
use super::*; use super::*;
use crate::{ use crate::{
@ -224,8 +224,8 @@ mod tests {
let vt2 = TypeId::of::<f32>(); let vt2 = TypeId::of::<f32>();
let mut values = settings.settings.write(); let mut values = settings.settings.write();
values.insert(vt1, Box::new(v1.clone())); values.insert(vt1, Box::new(v1));
values.insert(vt2, Box::new(v2.clone())); values.insert(vt2, Box::new(v2));
unsafe { unsafe {
settings.settings.force_unlock_write(); settings.settings.force_unlock_write();

Loading…
Cancel
Save