Skip to content

Commit 836fdac

Browse files
committed
use entry to not hash twice thanks clippy
(cherry picked from commit de9a7b9)
1 parent 0247dc4 commit 836fdac

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/cargo/ops/cargo_read_manifest.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ fn read_nested_packages(path: &Path,
138138
let pkg = Package::new(manifest, &manifest_path);
139139

140140
let pkg_id = pkg.package_id().clone();
141-
if !all_packages.contains_key(&pkg_id) {
142-
all_packages.insert(pkg_id, pkg);
143-
} else {
144-
info!("skipping nested package `{}` found at `{}`",
145-
pkg.name(), path.to_string_lossy());
141+
use ::std::collections::hash_map::Entry;
142+
match all_packages.entry(pkg_id) {
143+
Entry::Vacant(v) => { v.insert(pkg); },
144+
Entry::Occupied(_) => {
145+
info!("skipping nested package `{}` found at `{}`",
146+
pkg.name(), path.to_string_lossy());
147+
}
146148
}
147149

148150
// Registry sources are not allowed to have `path=` dependencies because

0 commit comments

Comments
 (0)