Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrwach committed Jan 7, 2024
1 parent 5abb9d7 commit 8aaa05a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 25 deletions.
4 changes: 0 additions & 4 deletions src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ pub fn aggregate(
} else {
output_colored_path(
&mut out,
&walk_options,
&path,
num_bytes,
num_errors,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/interactive/app/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,5 @@ pub fn pop_or_panic(v: &mut Vec<EntryInfo>) -> EntryInfo {
}

pub enum ProcessingResult {
Finished(WalkResult),
ExitRequested(WalkResult),
}
2 changes: 1 addition & 1 deletion src/interactive/app/bytevis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dua::{ByteFormat, WalkOptions};
use dua::{ByteFormat};
use std::fmt;

#[derive(Default, Clone, Copy)]
Expand Down
13 changes: 5 additions & 8 deletions src/interactive/app/eventloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ 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;
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;
Expand All @@ -31,7 +29,6 @@ use super::{
};
use super::{
app_state::{AppState, Cursor, ProcessingResult},
input::input_channel,
};

impl AppState {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/interactive/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub mod tree_view;

pub use bytevis::*;
pub use common::*;
pub use eventloop::*;
pub use handlers::*;

#[cfg(test)]
Expand Down
9 changes: 4 additions & 5 deletions src/interactive/app/terminal_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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;

Expand Down Expand Up @@ -153,7 +152,7 @@ impl TerminalApp {
events,
traversal,
)? {
ProcessingResult::Finished(res) | ProcessingResult::ExitRequested(res) => Ok(res),
ProcessingResult::ExitRequested(res) => Ok(res),
}
}
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
7 changes: 3 additions & 4 deletions src/traverse.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
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::{
fmt,
fs::Metadata,
io,
path::{Path, PathBuf},
sync::Arc,
time::{Duration, SystemTime, UNIX_EPOCH},
time::{SystemTime, UNIX_EPOCH},
};

pub type TreeIndex = NodeIndex;
Expand Down

0 comments on commit 8aaa05a

Please sign in to comment.