diff options
author | Piotr Wach <pwach@bloomberg.net> | 2024-01-07 20:39:10 +0000 |
---|---|---|
committer | Piotr Wach <pwach@bloomberg.net> | 2024-01-07 20:39:10 +0000 |
commit | 8aaa05ada6169860cd083a24764bc2c5915b220b (patch) | |
tree | c343163e3d849b30be0f04c159f6d2280216b054 /src | |
parent | 5abb9d7e8d18799caa4a2f3823e06b77bdb27133 (diff) |
clippy
Diffstat (limited to 'src')
-rw-r--r-- | src/aggregate.rs | 4 | ||||
-rw-r--r-- | src/interactive/app/app_state.rs | 1 | ||||
-rw-r--r-- | src/interactive/app/bytevis.rs | 2 | ||||
-rw-r--r-- | src/interactive/app/eventloop.rs | 13 | ||||
-rw-r--r-- | src/interactive/app/mod.rs | 1 | ||||
-rw-r--r-- | src/interactive/app/terminal_app.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/traverse.rs | 7 |
8 files changed, 14 insertions, 25 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs index 163a7eb..ec4d5ae 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -90,7 +90,6 @@ pub fn aggregate( } else { output_colored_path( &mut out, - &walk_options, &path, num_bytes, num_errors, @@ -111,7 +110,6 @@ pub fn aggregate( for (path, num_bytes, num_errors) in aggregates.into_iter() { output_colored_path( &mut out, - &walk_options, &path, num_bytes, num_errors, @@ -124,7 +122,6 @@ pub fn aggregate( if num_roots > 1 && compute_total { output_colored_path( &mut out, - &walk_options, Path::new("total"), total, res.num_errors, @@ -141,7 +138,6 @@ fn path_color_of(path: impl AsRef<Path>) -> Option<Color> { fn output_colored_path( out: &mut impl io::Write, - options: &WalkOptions, path: impl AsRef<Path>, num_bytes: u128, num_errors: u64, diff --git a/src/interactive/app/app_state.rs b/src/interactive/app/app_state.rs index 4578438..8d245db 100644 --- a/src/interactive/app/app_state.rs +++ b/src/interactive/app/app_state.rs @@ -107,6 +107,5 @@ pub fn pop_or_panic(v: &mut Vec<EntryInfo>) -> EntryInfo { } pub enum ProcessingResult { - Finished(WalkResult), ExitRequested(WalkResult), } diff --git a/src/interactive/app/bytevis.rs b/src/interactive/app/bytevis.rs index 26a99e7..96f934e 100644 --- a/src/interactive/app/bytevis.rs +++ b/src/interactive/app/bytevis.rs @@ -1,4 +1,4 @@ -use dua::{ByteFormat, WalkOptions}; +use dua::{ByteFormat}; use std::fmt; #[derive(Default, Clone, Copy)] diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs index 5644236..bd6b711 100644 --- a/src/interactive/app/eventloop.rs +++ b/src/interactive/app/eventloop.rs @@ -4,9 +4,8 @@ use crate::{ app::navigation::Navigation, app_state::FocussedPane, sorted_entries, - widgets::{glob_search, MainWindow, MainWindowProps}, - ByteVisualization, CursorDirection, CursorMode, DisplayOptions, EntryDataBundle, - MarkEntryMode, SortMode, + widgets::{glob_search, MainWindow, MainWindowProps}, CursorDirection, CursorMode, DisplayOptions, + MarkEntryMode, }, }; use anyhow::Result; @@ -14,11 +13,10 @@ use crossbeam::channel::Receiver; use crosstermion::crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers}; use crosstermion::input::Event; use dua::{ - traverse::{size_on_disk, EntryData, Traversal, Tree}, + traverse::{size_on_disk, EntryData, Traversal}, WalkOptions, WalkResult, }; use std::{ - path::PathBuf, time::{SystemTime, UNIX_EPOCH}, }; use tui::backend::Backend; @@ -31,7 +29,6 @@ use super::{ }; use super::{ app_state::{AppState, Cursor, ProcessingResult}, - input::input_channel, }; impl AppState { @@ -318,10 +315,10 @@ impl AppState { return true; } } - return false; + false } - fn update_state<'a>(&mut self, traversal: &'a Traversal) { + fn update_state(&mut self, traversal: &Traversal) { let received_events = self.traversal_state.received_event; if !received_events { self.navigation_mut().view_root = traversal.root_index; diff --git a/src/interactive/app/mod.rs b/src/interactive/app/mod.rs index 2dd74eb..f4f6d3e 100644 --- a/src/interactive/app/mod.rs +++ b/src/interactive/app/mod.rs @@ -10,7 +10,6 @@ pub mod tree_view; pub use bytevis::*; pub use common::*; -pub use eventloop::*; pub use handlers::*; #[cfg(test)] diff --git a/src/interactive/app/terminal_app.rs b/src/interactive/app/terminal_app.rs index f3e3369..8728f14 100644 --- a/src/interactive/app/terminal_app.rs +++ b/src/interactive/app/terminal_app.rs @@ -13,8 +13,7 @@ use tui_react::Terminal; use crate::{crossdev, interactive::widgets::MainWindow}; use super::{ - app_state::{AppState, ProcessingResult, TraversalState}, - refresh_key, sorted_entries, ByteVisualization, DisplayOptions, + app_state::{AppState, ProcessingResult, TraversalState}, sorted_entries, DisplayOptions, }; /// State and methods representing the interactive disk usage analyser for the terminal @@ -77,7 +76,7 @@ impl TerminalApp { ); state.navigation_mut().selected = state.entries.first().map(|b| b.index); - let mut app = TerminalApp { + let app = TerminalApp { state, display, traversal, @@ -87,7 +86,7 @@ impl TerminalApp { Ok(app) } - pub fn scan<'a>(&mut self, input: Vec<PathBuf>) -> Result<Receiver<TraversalEvent>> { + pub fn scan(&mut self, input: Vec<PathBuf>) -> Result<Receiver<TraversalEvent>> { self.state.traversal_state = TraversalState::new(self.traversal.root_index); self.state.is_scanning = true; @@ -153,7 +152,7 @@ impl TerminalApp { events, traversal, )? { - ProcessingResult::Finished(res) | ProcessingResult::ExitRequested(res) => Ok(res), + ProcessingResult::ExitRequested(res) => Ok(res), } } } diff --git a/src/main.rs b/src/main.rs index a3b314c..fcee61f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use std::{fs, io, io::Write, path::PathBuf, process}; use crate::interactive::input::input_channel; use crate::interactive::terminal_app::TerminalApp; -use crate::options::ByteFormat; + mod crossdev; #[cfg(feature = "tui-crossplatform")] diff --git a/src/traverse.rs b/src/traverse.rs index 98cf41c..6ed7a60 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -1,5 +1,5 @@ -use crate::{crossdev, get_size_or_panic, InodeFilter, Throttle, WalkOptions}; -use anyhow::Result; +use crate::{get_size_or_panic}; + use filesize::PathExt; use petgraph::{graph::NodeIndex, stable_graph::StableGraph, Directed, Direction}; use std::{ @@ -7,8 +7,7 @@ use std::{ fs::Metadata, io, path::{Path, PathBuf}, - sync::Arc, - time::{Duration, SystemTime, UNIX_EPOCH}, + time::{SystemTime, UNIX_EPOCH}, }; pub type TreeIndex = NodeIndex; |