Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies and avoid cloning #133

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 24 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ license = "MIT"
readme = "README.md"

[dependencies]
anyhow = "1.0.57"
anyhow = "1.0.86"
argh = "0.1.9"
cargo_metadata = "0.18.0"
cargo_toml = "0.19.1"
cargo_toml = "0.20.4"
grep = "0.3.1"
ignore = "0.4.20"
log = "0.4.16"
ignore = "0.4.22"
log = "0.4.22"
pretty_env_logger = "0.5.0"
rayon = "1.5.2"
serde = "1.0.136"
Expand Down
20 changes: 7 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ fn collect_paths(path: &Path, options: CollectPathOptions) -> Result<Vec<PathBuf
// `PathBuf`.
walker
.into_iter()
.filter(|entry| match entry {
Ok(entry) => entry.file_name() == "Cargo.toml",
Err(_) => true,
.filter(|entry| {
entry
.as_ref()
.map_or(true, |entry| entry.file_name() == "Cargo.toml")
})
.map(|res_entry| res_entry.map(|e| e.into_path()))
.collect()
Expand Down Expand Up @@ -123,7 +124,6 @@ fn run_machete() -> anyhow::Result<bool> {
"Analyzing dependencies of crates in {}...",
args.paths
.iter()
.cloned()
.map(|path| path.as_os_str().to_string_lossy().to_string())
.collect::<Vec<_>>()
.join(",")
Expand Down Expand Up @@ -191,17 +191,11 @@ fn run_machete() -> anyhow::Result<bool> {
};

if results.is_empty() {
println!(
"cargo-machete didn't find any unused dependencies in {}. Good job!",
location
);
println!("cargo-machete didn't find any unused dependencies in {location}. Good job!");
continue;
}

println!(
"cargo-machete found the following unused dependencies in {}:",
location
);
println!("cargo-machete found the following unused dependencies in {location}:");
for (analysis, path) in results {
println!("{} -- {}:", analysis.package_name, path.to_string_lossy());
for dep in &analysis.unused {
Expand Down Expand Up @@ -240,7 +234,7 @@ fn run_machete() -> anyhow::Result<bool> {
);
}

println!()
println!();
}

eprintln!("Done!");
Expand Down
6 changes: 3 additions & 3 deletions src/search_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl PackageAnalysis {
metadata,
manifest,
package_name,
unused: Default::default(),
ignored_used: Default::default(),
unused: Vec::default(),
ignored_used: Vec::default(),
})
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ pub(crate) fn find_unused(
debug!("handling {} ({})", package_name, dir_path.display());

let mut analysis = PackageAnalysis::new(
package_name.clone(),
package_name,
manifest_path,
manifest,
matches!(with_cargo_metadata, UseCargoMetadata::Yes),
Expand Down
Loading