summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2023-05-02 11:04:46 +0200
committerSebastian Thiel <sebastian.thiel@icloud.com>2023-05-05 12:28:10 +0200
commit565581fc11faf7512c27fe9095090f482a8d32f0 (patch)
tree2a42b28ceab3b26ad2b057b74f3913490aa1b06b
parentc921dc72d3008179e72df9d85f0e0c21c998e199 (diff)
thanks clippy
-rw-r--r--src/interactive/app/bytevis.rs9
-rw-r--r--src/interactive/app/common.rs9
-rw-r--r--src/interactive/app/eventloop.rs9
-rw-r--r--src/interactive/widgets/mark.rs2
-rw-r--r--src/traverse.rs6
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<Item = PathBuf> {
- 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<MarkMode>)> {
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);
}
}
}