From db51b11c083e6e33934baf13807f28430c5bf697 Mon Sep 17 00:00:00 2001 From: Ville Hakulinen Date: Thu, 23 Jul 2020 15:21:56 +0300 Subject: Fix rest of the clippy warnings --- src/ui/cursor_tooltip.rs | 17 ++++++++--------- src/ui/grid/context.rs | 1 + src/ui/grid/grid.rs | 1 + src/ui/grid/mod.rs | 1 + src/ui/grid/render.rs | 1 + src/ui/mod.rs | 1 + src/ui/popupmenu/mod.rs | 1 + 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ui/cursor_tooltip.rs b/src/ui/cursor_tooltip.rs index b78e62c..256571c 100644 --- a/src/ui/cursor_tooltip.rs +++ b/src/ui/cursor_tooltip.rs @@ -116,8 +116,8 @@ impl CursorTooltip { let frame_weak = frame.downgrade(); let fixed_weak = fixed.downgrade(); webview.connect_load_changed( - clone!(frame_weak, fixed_weak, state => move |webview, e| match e { - webkit::LoadEvent::Finished => { + clone!(frame_weak, fixed_weak, state => move |webview, e| { + if let webkit::LoadEvent::Finished = e { webview_load_finished( webview, frame_weak.clone(), @@ -125,7 +125,6 @@ impl CursorTooltip { state.clone(), ); } - _ => {} }), ); @@ -145,7 +144,7 @@ impl CursorTooltip { state.scale = res / 96.0; // 96.0 picked from GTK's own source code. webview.set_zoom_level(state.scale); - state.available_area = alloc.clone(); + state.available_area = *alloc; }), ); @@ -254,9 +253,9 @@ impl CursorTooltip { .contains(&lang.to_string()) }) // And if not still found, use the plain text one. - .unwrap_or( - self.syntax_set.find_syntax_plain_text(), - ) + .unwrap_or_else(|| { + self.syntax_set.find_syntax_plain_text() + }) }); in_code_block = true; @@ -363,7 +362,7 @@ impl CursorTooltip { pub fn move_to(&mut self, rect: &gdk::Rectangle) { let mut state = self.state.borrow_mut(); - state.anchor = rect.clone(); + state.anchor = *rect; } /// Forces the gravity of the tooltip to be above or below of current @@ -396,7 +395,7 @@ fn set_position( width: i32, height: i32, ) { - let mut available_area = state.available_area.clone(); + let mut available_area = state.available_area; match state.force_gravity { Some(Gravity::Up) => { diff --git a/src/ui/grid/context.rs b/src/ui/grid/context.rs index 6b12228..2cac653 100644 --- a/src/ui/grid/context.rs +++ b/src/ui/grid/context.rs @@ -35,6 +35,7 @@ pub struct Context { } impl Context { + #[allow(clippy::too_many_arguments)] pub fn new( da: &DrawingArea, win: &gdk::Window, diff --git a/src/ui/grid/grid.rs b/src/ui/grid/grid.rs index 9cad198..e9cf7c1 100644 --- a/src/ui/grid/grid.rs +++ b/src/ui/grid/grid.rs @@ -78,6 +78,7 @@ pub struct Grid { } impl Grid { + #[allow(clippy::too_many_arguments)] pub fn new( id: i64, win: &gdk::Window, diff --git a/src/ui/grid/mod.rs b/src/ui/grid/mod.rs index 0dc686e..99a49eb 100644 --- a/src/ui/grid/mod.rs +++ b/src/ui/grid/mod.rs @@ -1,5 +1,6 @@ mod context; mod cursor; +#[allow(clippy::module_inception)] mod grid; mod render; mod row; diff --git a/src/ui/grid/render.rs b/src/ui/grid/render.rs index 441db16..c991277 100644 --- a/src/ui/grid/render.rs +++ b/src/ui/grid/render.rs @@ -20,6 +20,7 @@ use crate::ui::grid::row::{Cell, Segment}; /// * `y` - Target y coordinate for `cr`. /// * `w` - Target width for `cr`. /// * `h` - Target height for `cr`. +#[allow(clippy::too_many_arguments, clippy::many_single_char_names)] fn render_text( cr: &cairo::Context, pango_context: &pango::Context, diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 033a037..b8cc38c 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -57,6 +57,7 @@ mod grid; mod popupmenu; mod state; mod tabline; +#[allow(clippy::module_inception)] mod ui; mod wildmenu; mod window; diff --git a/src/ui/popupmenu/mod.rs b/src/ui/popupmenu/mod.rs index 074013a..665c251 100644 --- a/src/ui/popupmenu/mod.rs +++ b/src/ui/popupmenu/mod.rs @@ -1,5 +1,6 @@ mod completion_item_widget; mod lazy_loader; +#[allow(clippy::module_inception)] mod popupmenu; use self::completion_item_widget::get_icon_pixbuf; -- cgit v1.2.3