Fixed some clippy warnings

macos-click-through
Keith Simmons 3 years ago
parent b7b06c59a0
commit 3d4bd0e056

@ -591,17 +591,17 @@ fn parse_grid_line_cell(grid_line_cell: Value) -> Result<GridLineCell> {
let text_value = cell_contents let text_value = cell_contents
.first_mut() .first_mut()
.map(|v| take_value(v)) .map(take_value)
.ok_or_else(|| ParseError::Format(format!("{:?}", cell_contents)))?; .ok_or_else(|| ParseError::Format(format!("{:?}", cell_contents)))?;
let highlight_id = cell_contents let highlight_id = cell_contents
.get_mut(1) .get_mut(1)
.map(|v| take_value(v)) .map(take_value)
.map(parse_u64) .map(parse_u64)
.transpose()?; .transpose()?;
let repeat = cell_contents let repeat = cell_contents
.get_mut(2) .get_mut(2)
.map(|v| take_value(v)) .map(take_value)
.map(parse_u64) .map(parse_u64)
.transpose()?; .transpose()?;

@ -69,14 +69,14 @@ impl Cursor {
self.style self.style
.as_ref() .as_ref()
.and_then(|s| s.colors.foreground) .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 { pub fn background(&self, default_colors: &Colors) -> Color4f {
self.style self.style
.as_ref() .as_ref()
.and_then(|s| s.colors.background) .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<u64, Arc<Style>>) { pub fn change_mode(&mut self, cursor_mode: &CursorMode, styles: &HashMap<u64, Arc<Style>>) {

@ -4,33 +4,10 @@ use std::time::Instant;
use log::trace; use log::trace;
use crate::{cmd_line::CmdLineSettings, settings::*};
lazy_static! { lazy_static! {
pub static ref REDRAW_SCHEDULER: RedrawScheduler = RedrawScheduler::new(); 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::<CmdLineSettings>()
.neovim_args
.contains(&"--extraBufferFrames".to_string())
{
60
} else {
1
},
}
}
}
pub struct RedrawScheduler { pub struct RedrawScheduler {
scheduled_frame: Mutex<Option<Instant>>, scheduled_frame: Mutex<Option<Instant>>,
frame_queued: AtomicBool, frame_queued: AtomicBool,

@ -87,7 +87,7 @@ impl Settings {
let keys: Vec<String> = self.listeners.read().keys().cloned().collect(); let keys: Vec<String> = self.listeners.read().keys().cloned().collect();
for name in keys { 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 { match nvim.get_var(&variable_name).await {
Ok(value) => { Ok(value) => {
self.listeners.read().get(&name).unwrap()(value); self.listeners.read().get(&name).unwrap()(value);

Loading…
Cancel
Save