Skip to content

Commit

Permalink
Tell the user when --recursive is traversing folders
Browse files Browse the repository at this point in the history
After calling `cargo-sweep` with `--recursive` in a big folder, the tool
usually stays silent for a long time leaving the user wondering what's
going on

To solve that, I added a log that tells that `cargo-sweep` is traversing
recursively directories, that's why it's taking long
  • Loading branch information
marcospb19 committed Sep 18, 2023
1 parent fd4dc9e commit 208f8e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ fn main() -> anyhow::Result<()> {
};

let processed_paths = if args.recursive {
info!("Searching recursively for Rust project folders");
paths
.iter()
.flat_map(|path| find_cargo_projects(path, args.hidden))
Expand Down
10 changes: 7 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,14 @@ fn check_toolchain_listing_on_multiple_projects() -> TestResult {
.filter(|line| line.starts_with("[INFO]"))
.collect::<Vec<_>>();

assert_eq!(lines.len(), 3);
assert!(lines[0].starts_with("[INFO] Using all installed toolchains:"));
assert!(lines[1].starts_with("[INFO] Would clean:"));
assert_eq!(lines.len(), 4);
assert_eq!(
lines[0].trim(),
"[INFO] Searching recursively for Rust project folders"
);
assert!(lines[1].starts_with("[INFO] Using all installed toolchains:"));
assert!(lines[2].starts_with("[INFO] Would clean:"));
assert!(lines[3].starts_with("[INFO] Would clean:"));

Ok(())
}

0 comments on commit 208f8e6

Please sign in to comment.