From 4687b3bb48b49c0a1ffaade299aea0480ff3d488 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 5 Jan 2020 15:14:32 -0800 Subject: [PATCH] clippy --- src/frontend/gui/termwindow.rs | 6 ++++-- src/localtab.rs | 2 +- src/server/codec.rs | 1 + src/stats.rs | 2 +- src/termwiztermtab.rs | 2 +- term/src/screen.rs | 1 + 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/frontend/gui/termwindow.rs b/src/frontend/gui/termwindow.rs index f79f359b1..fd9bc52f5 100644 --- a/src/frontend/gui/termwindow.rs +++ b/src/frontend/gui/termwindow.rs @@ -1,3 +1,4 @@ +#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] use super::quad::*; use super::renderstate::*; use super::utilsprites::RenderMetrics; @@ -219,7 +220,7 @@ impl WindowCallbacks for TermWindow { log::trace!("Setting focus to {:?}", focused); self.focused = if focused { Some(Instant::now()) } else { None }; - if !self.focused.is_some() { + if self.focused.is_none() { self.last_mouse_click = None; self.current_mouse_button = None; } @@ -1646,6 +1647,7 @@ impl TermWindow { /// This is nominally a matter of setting the fg/bg color and the /// texture coordinates for a given glyph. There's a little bit /// of extra complexity to deal with multi-cell glyphs. + #[allow(clippy::too_many_arguments)] fn render_screen_line_opengl( &self, line_idx: usize, @@ -2254,7 +2256,7 @@ impl TermWindow { } fn get_viewport(&mut self, tab_id: TabId) -> Option { - self.tab_state(tab_id).viewport.clone() + self.tab_state(tab_id).viewport } fn set_viewport( diff --git a/src/localtab.rs b/src/localtab.rs index f626ebc86..1244eafb2 100644 --- a/src/localtab.rs +++ b/src/localtab.rs @@ -83,7 +83,7 @@ impl Tab for LocalTab { } fn palette(&self) -> ColorPalette { - self.terminal.borrow().palette().clone() + self.terminal.borrow().palette() } fn domain_id(&self) -> DomainId { diff --git a/src/server/codec.rs b/src/server/codec.rs index 4615ff52f..cd5652fbc 100644 --- a/src/server/codec.rs +++ b/src/server/codec.rs @@ -9,6 +9,7 @@ //! of this code; in this way the client and server can more gracefully //! manage unknown enum variants. #![allow(dead_code)] +#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] use crate::mux::domain::DomainId; use crate::mux::renderable::{RenderableDimensions, StableCursorPosition}; diff --git a/src/stats.rs b/src/stats.rs index 0a77712e9..7b19dc3b0 100644 --- a/src/stats.rs +++ b/src/stats.rs @@ -114,7 +114,7 @@ impl Recorder for Stats { let mut inner = self.inner.lock().unwrap(); let histogram = inner .histograms - .entry(key.clone()) + .entry(key) .or_insert_with(|| Histogram::new(2).expect("failed to crate new Histogram")); histogram.record(value).ok(); } diff --git a/src/termwiztermtab.rs b/src/termwiztermtab.rs index f4bcf10c5..c0b816171 100644 --- a/src/termwiztermtab.rs +++ b/src/termwiztermtab.rs @@ -116,7 +116,7 @@ impl Renderable for RenderableState { if inner.something_changed.load(Ordering::SeqCst) || inner.surface.has_changes(inner.local_sequence) { - lines.into_iter().collect() + lines.collect() } else { vec![] } diff --git a/term/src/screen.rs b/term/src/screen.rs index 200ab9c89..1faf31442 100644 --- a/term/src/screen.rs +++ b/term/src/screen.rs @@ -1,3 +1,4 @@ +#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] use super::*; use log::debug; use std::collections::VecDeque;