Skip to content

Commit

Permalink
Remove needless borrows
Browse files Browse the repository at this point in the history
  • Loading branch information
gblach committed Jan 14, 2023
1 parent ef0fc42 commit 705c684
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ fn make_links(linkindex: &SubIndex, directory: &Path, args: &utils::Args) -> u64
pub fn mainloop(index: &mut Index, directory: &Path, args: &utils::Args) -> u64 {
let mut saved_bytes: u64 = 0;

for mut subindex in index.values_mut() {
for subindex in index.values_mut() {
while subindex.len() > 1 {
let linkindex = subindex_linkable(&mut subindex);
let linkindex = subindex_linkable(subindex);
if linkindex.len() > 1 {
saved_bytes += make_links(&linkindex, &directory, &args);
saved_bytes += make_links(&linkindex, directory, args);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() -> ExitCode {

for directory in args.directories.iter() {
let directory = Path::new(directory);
if ! index::scandir_checks(&directory, &args) {
if ! index::scandir_checks(directory, &args) {
return ExitCode::from(1);
}
}
Expand All @@ -29,26 +29,26 @@ fn main() -> ExitCode {
let mut indexfile: index::IndexFile = HashMap::new();

if let Some(cdb_r) = &cdb_r {
indexfile = index::indexfile_get(cdb_r, &directory);
indexfile = index::indexfile_get(cdb_r, directory);
}

if ! args.quiet {
println!("Scanning \x1b[0;1m{}\x1b[0m directory ...",
directory.to_string_lossy());
}
index::scandir(&mut index, &directory);
index::scandir(&mut index, directory);
index.retain(|_, v| v.len() > 1);

if ! args.quiet {
println!("Computing file hashes ...");
}
index::make_file_hashes(&mut index, &directory, &indexfile, &args);
index::make_file_hashes(&mut index, directory, &indexfile, &args);

if let Some(cdb_w) = &mut cdb_w {
index::indexfile_set(cdb_w, &directory, &index);
index::indexfile_set(cdb_w, directory, &index);
}

saved_bytes += index::mainloop(&mut index, &directory, &args);
saved_bytes += index::mainloop(&mut index, directory, &args);
}

if let Some(cdb_w) = cdb_w {
Expand Down

0 comments on commit 705c684

Please sign in to comment.