From 565581fc11faf7512c27fe9095090f482a8d32f0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 2 May 2023 11:04:46 +0200 Subject: thanks clippy --- src/interactive/app/bytevis.rs | 9 ++------- src/interactive/app/common.rs | 9 ++------- src/interactive/app/eventloop.rs | 9 ++------- src/interactive/widgets/mark.rs | 2 +- src/traverse.rs | 6 ++---- 5 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/interactive/app/bytevis.rs b/src/interactive/app/bytevis.rs index 1bfda70..d767ed1 100644 --- a/src/interactive/app/bytevis.rs +++ b/src/interactive/app/bytevis.rs @@ -1,11 +1,12 @@ use dua::{ByteFormat, WalkOptions}; use std::fmt; -#[derive(Clone, Copy)] +#[derive(Default, Clone, Copy)] pub enum ByteVisualization { Percentage, Bar, LongBar, + #[default] PercentageAndBar, } @@ -14,12 +15,6 @@ pub struct DisplayByteVisualization { percentage: f32, } -impl Default for ByteVisualization { - fn default() -> Self { - ByteVisualization::PercentageAndBar - } -} - impl ByteVisualization { pub fn cycle(&mut self) { use ByteVisualization::*; diff --git a/src/interactive/app/common.rs b/src/interactive/app/common.rs index 5844194..b44874a 100644 --- a/src/interactive/app/common.rs +++ b/src/interactive/app/common.rs @@ -4,8 +4,9 @@ use itertools::Itertools; use petgraph::Direction; use unicode_segmentation::UnicodeSegmentation; -#[derive(Debug, Copy, Clone, PartialOrd, PartialEq, Eq)] +#[derive(Default, Debug, Copy, Clone, PartialOrd, PartialEq, Eq)] pub enum SortMode { + #[default] SizeDescending, SizeAscending, } @@ -20,12 +21,6 @@ impl SortMode { } } -impl Default for SortMode { - fn default() -> Self { - SortMode::SizeDescending - } -} - pub struct EntryDataBundle { pub index: TreeIndex, pub data: EntryData, diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs index 6778070..fb4faa6 100644 --- a/src/interactive/app/eventloop.rs +++ b/src/interactive/app/eventloop.rs @@ -14,19 +14,14 @@ use std::{collections::BTreeMap, path::PathBuf}; use tui::backend::Backend; use tui_react::Terminal; -#[derive(Copy, Clone)] +#[derive(Default, Copy, Clone)] pub enum FocussedPane { + #[default] Main, Help, Mark, } -impl Default for FocussedPane { - fn default() -> Self { - FocussedPane::Main - } -} - #[derive(Default)] pub struct AppState { pub root: TreeIndex, diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index 291c149..4860ef2 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -105,7 +105,7 @@ impl MarkPane { &self.marked } pub fn into_paths(self) -> impl Iterator { - self.marked.into_iter().map(|(_k, v)| v.path) + self.marked.into_values().map(|v| v.path) } pub fn process_events(mut self, key: Key) -> Option<(Self, Option)> { let action = None; diff --git a/src/traverse.rs b/src/traverse.rs index 80305eb..d33eed1 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -184,10 +184,8 @@ impl Traversal { } } - if throttle.can_update() { - if update(&mut t)? { - return Ok(None); - } + if throttle.can_update() && update(&mut t)? { + return Ok(None); } } } -- cgit v1.2.3