mirror of
https://github.com/sreedevk/deduplicator.git
synced 2026-08-26 02:04:39 +00:00
clippy
This commit is contained in:
@@ -20,7 +20,6 @@ impl FileInfo {
|
||||
|
||||
mapper
|
||||
.chunks(1_000_000)
|
||||
.into_iter()
|
||||
.for_each(|chunk| primhasher.write(chunk));
|
||||
|
||||
Ok(Self {
|
||||
|
||||
@@ -16,8 +16,12 @@ use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
impl Formatter {
|
||||
pub fn human_path(file: &FileInfo, app_args: &Params, min_path_length: usize) -> Result<String> {
|
||||
let base_directory: PathBuf = app_args.get_directory()?.to_path_buf();
|
||||
pub fn human_path(
|
||||
file: &FileInfo,
|
||||
app_args: &Params,
|
||||
min_path_length: usize,
|
||||
) -> Result<String> {
|
||||
let base_directory: PathBuf = app_args.get_directory()?;
|
||||
let relative_path = diff_paths(file.path.clone(), base_directory).unwrap_or_default();
|
||||
|
||||
let formatted_path = format!(
|
||||
@@ -61,8 +65,7 @@ impl Formatter {
|
||||
progress_bar.set_message("reconciling data");
|
||||
|
||||
let duplicates_table: DashMap<String, Vec<FileInfo>> = DashMap::new();
|
||||
raw.clone()
|
||||
.into_par_iter()
|
||||
raw.into_par_iter()
|
||||
.progress_with(progress_bar)
|
||||
.with_finish(ProgressFinish::WithMessage(Cow::from("data reconciled")))
|
||||
.map(|file| file.hash())
|
||||
@@ -95,11 +98,11 @@ impl Formatter {
|
||||
inner_table.set_format(*format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||
group.iter().for_each(|file| {
|
||||
inner_table.add_row(row![
|
||||
Self::human_path(&file, &app_args, min_path_length)
|
||||
Self::human_path(file, app_args, min_path_length)
|
||||
.unwrap_or_default()
|
||||
.blue(),
|
||||
Self::human_filesize(&file).unwrap_or_default().red(),
|
||||
Self::human_mtime(&file).unwrap_or_default().yellow()
|
||||
Self::human_filesize(file).unwrap_or_default().red(),
|
||||
Self::human_mtime(file).unwrap_or_default().yellow()
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ pub fn init(result: Vec<FileInfo>, app_args: &Params) -> Result<()> {
|
||||
|
||||
let duplicates: DashMap<String, Vec<FileInfo>> = DashMap::new();
|
||||
result
|
||||
.clone()
|
||||
.into_par_iter()
|
||||
.progress_with(progress_bar)
|
||||
.with_finish(ProgressFinish::WithMessage(Cow::from("data reconciled")))
|
||||
@@ -84,11 +83,11 @@ pub fn init(result: Vec<FileInfo>, app_args: &Params) -> Result<()> {
|
||||
group.iter().enumerate().for_each(|(index, file)| {
|
||||
itable.add_row(row![
|
||||
index,
|
||||
Formatter::human_path(&file, app_args, max_filepath_length)
|
||||
Formatter::human_path(file, app_args, min_path_length)
|
||||
.unwrap_or_default()
|
||||
.blue(),
|
||||
Formatter::human_filesize(file).unwrap_or_default().red(),
|
||||
Formatter::human_mtime(&file).unwrap_or_default().yellow()
|
||||
Formatter::human_mtime(file).unwrap_or_default().yellow()
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ impl Scanner {
|
||||
path
|
||||
})
|
||||
.filter(|path| path.is_file())
|
||||
.map(|file| FileInfo::new(file))
|
||||
.map(FileInfo::new)
|
||||
.filter_map(Result::ok)
|
||||
.filter(|file| file.size > min_size)
|
||||
.collect::<Vec<FileInfo>>();
|
||||
|
||||
Reference in New Issue
Block a user