From 3d4bd0e056b9fab93c2eccc41196a2f8b9ecdb25 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Sun, 28 Nov 2021 20:32:27 -0800 Subject: [PATCH] Fixed some clippy warnings --- src/bridge/events.rs | 6 +++--- src/editor/cursor.rs | 4 ++-- src/redraw_scheduler.rs | 23 ----------------------- src/settings/mod.rs | 2 +- 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/bridge/events.rs b/src/bridge/events.rs index 506fe07..88fb18d 100644 --- a/src/bridge/events.rs +++ b/src/bridge/events.rs @@ -591,17 +591,17 @@ fn parse_grid_line_cell(grid_line_cell: Value) -> Result { let text_value = cell_contents .first_mut() - .map(|v| take_value(v)) + .map(take_value) .ok_or_else(|| ParseError::Format(format!("{:?}", cell_contents)))?; let highlight_id = cell_contents .get_mut(1) - .map(|v| take_value(v)) + .map(take_value) .map(parse_u64) .transpose()?; let repeat = cell_contents .get_mut(2) - .map(|v| take_value(v)) + .map(take_value) .map(parse_u64) .transpose()?; diff --git a/src/editor/cursor.rs b/src/editor/cursor.rs index a56ca51..2842cc3 100644 --- a/src/editor/cursor.rs +++ b/src/editor/cursor.rs @@ -69,14 +69,14 @@ impl Cursor { self.style .as_ref() .and_then(|s| s.colors.foreground) - .unwrap_or(default_colors.background.unwrap()) + .unwrap_or_else(|| default_colors.background.unwrap()) } pub fn background(&self, default_colors: &Colors) -> Color4f { self.style .as_ref() .and_then(|s| s.colors.background) - .unwrap_or(default_colors.foreground.unwrap()) + .unwrap_or_else(|| default_colors.foreground.unwrap()) } pub fn change_mode(&mut self, cursor_mode: &CursorMode, styles: &HashMap>) { diff --git a/src/redraw_scheduler.rs b/src/redraw_scheduler.rs index 4784591..ac39b8d 100644 --- a/src/redraw_scheduler.rs +++ b/src/redraw_scheduler.rs @@ -4,33 +4,10 @@ use std::time::Instant; use log::trace; -use crate::{cmd_line::CmdLineSettings, settings::*}; - lazy_static! { pub static ref REDRAW_SCHEDULER: RedrawScheduler = RedrawScheduler::new(); } -#[derive(Clone, SettingGroup)] -pub struct RedrawSettings { - extra_buffer_frames: u64, -} - -impl Default for RedrawSettings { - fn default() -> Self { - Self { - extra_buffer_frames: if SETTINGS - .get::() - .neovim_args - .contains(&"--extraBufferFrames".to_string()) - { - 60 - } else { - 1 - }, - } - } -} - pub struct RedrawScheduler { scheduled_frame: Mutex>, frame_queued: AtomicBool, diff --git a/src/settings/mod.rs b/src/settings/mod.rs index ada92e8..7d0ac68 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -87,7 +87,7 @@ impl Settings { let keys: Vec = self.listeners.read().keys().cloned().collect(); for name in keys { - let variable_name = format!("neovide_{}", name.to_string()); + let variable_name = format!("neovide_{}", name); match nvim.get_var(&variable_name).await { Ok(value) => { self.listeners.read().get(&name).unwrap()(value);