From 86fafbd47b3eccb6eaf5ad579fde44b22713de57 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Mon, 22 Jun 2020 12:32:01 +0200 Subject: [PATCH] clippy fixes --- src/components/commit_details/details.rs | 2 +- src/components/diff.rs | 2 +- src/components/filetree.rs | 8 ++++---- src/components/reset.rs | 8 ++++---- src/components/textinput.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/commit_details/details.rs b/src/components/commit_details/details.rs index e32d11d0..6d9d0821 100644 --- a/src/components/commit_details/details.rs +++ b/src/components/commit_details/details.rs @@ -34,7 +34,7 @@ impl DetailsComponent { Self { data: None, tags: Vec::new(), - theme: theme, + theme, } } diff --git a/src/components/diff.rs b/src/components/diff.rs index 7988fa96..fdef3443 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -52,7 +52,7 @@ impl DiffComponent { current_size: (0, 0), selection: 0, scroll_top: 0, - theme: theme, + theme, } } /// diff --git a/src/components/filetree.rs b/src/components/filetree.rs index 4be81475..a011b65a 100644 --- a/src/components/filetree.rs +++ b/src/components/filetree.rs @@ -128,12 +128,12 @@ impl FileTreeComponent { changed } - fn item_to_text( + fn item_to_text<'a>( item: &FileTreeItem, width: u16, selected: bool, - theme: SharedTheme, - ) -> Option { + theme: &'a SharedTheme, + ) -> Option> { let indent_str = if item.info.indent == 0 { String::from("") } else { @@ -242,7 +242,7 @@ impl DrawableComponent for FileTreeComponent { .tree .selection .map_or(false, |e| e == idx), - self.theme.clone(), + &self.theme, ) }, ); diff --git a/src/components/reset.rs b/src/components/reset.rs index ffbdee2f..a3ffa70a 100644 --- a/src/components/reset.rs +++ b/src/components/reset.rs @@ -5,11 +5,10 @@ use crate::{ }, queue::{Action, InternalEvent, Queue}, strings, ui, - ui::style::Theme, }; use anyhow::Result; use crossterm::event::{Event, KeyCode}; -use std::{borrow::Cow, rc::Rc}; +use std::borrow::Cow; use strings::commands; use tui::{ backend::Backend, @@ -17,13 +16,14 @@ use tui::{ widgets::{Clear, Text}, Frame, }; +use ui::style::SharedTheme; /// pub struct ResetComponent { target: Option, visible: bool, queue: Queue, - theme: Rc>, + theme: SharedTheme, } impl DrawableComponent for ResetComponent { @@ -111,7 +111,7 @@ impl Component for ResetComponent { impl ResetComponent { /// - pub fn new(queue: Queue, theme: Rc>) -> Self { + pub fn new(queue: Queue, theme: SharedTheme) -> Self { Self { target: None, visible: false, diff --git a/src/components/textinput.rs b/src/components/textinput.rs index 94566eb6..9d21d8e1 100644 --- a/src/components/textinput.rs +++ b/src/components/textinput.rs @@ -37,7 +37,7 @@ impl TextInputComponent { Self { msg: String::default(), visible: false, - theme: theme, + theme, title: title.to_string(), default_msg: default_msg.to_string(), cursor_position: 0,