Skip to content

Commit a9f2942

Browse files
committed
one more small change
1 parent 2d6fc56 commit a9f2942

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/cargo/core/resolver/context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ impl Context {
179179
for dep in deps {
180180
// Skip optional dependencies, but not those enabled through a
181181
// feature
182-
if dep.is_optional() && !reqs.deps.contains_key(&*dep.name()) {
182+
if dep.is_optional() && !reqs.deps.contains_key(&dep.name()) {
183183
continue;
184184
}
185185
// So we want this dependency. Move the features we want from
186186
// `feature_deps` to `ret` and register ourselves as using this
187187
// name.
188-
let base = reqs.deps.get(&*dep.name()).unwrap_or(&default_dep);
189-
used_features.insert(dep.name().as_str());
188+
let base = reqs.deps.get(&dep.name()).unwrap_or(&default_dep);
189+
used_features.insert(dep.name());
190190
let always_required = !dep.is_optional()
191191
&& !s.dependencies()
192192
.iter()
@@ -218,8 +218,8 @@ impl Context {
218218
// them as dependencies in the first place because there is no such
219219
// feature, either.
220220
let remaining = reqs.deps.keys()
221-
.cloned()
222221
.filter(|s| !used_features.contains(s))
222+
.map(|s| s.as_str())
223223
.collect::<Vec<_>>();
224224
if !remaining.is_empty() {
225225
let features = remaining.join(", ");
@@ -337,7 +337,7 @@ struct Requirements<'a> {
337337
// specified set of features enabled. The boolean indicates whether this
338338
// package was specifically requested (rather than just requesting features
339339
// *within* this package).
340-
deps: HashMap<&'a str, (bool, Vec<InternedString>)>,
340+
deps: HashMap<InternedString, (bool, Vec<InternedString>)>,
341341
// The used features set is the set of features which this local package had
342342
// enabled, which is later used when compiling to instruct the code what
343343
// features were enabled.
@@ -358,7 +358,7 @@ impl<'r> Requirements<'r> {
358358
fn require_crate_feature(&mut self, package: InternedString, feat: InternedString) {
359359
self.used.insert(package);
360360
self.deps
361-
.entry(package.as_str())
361+
.entry(package)
362362
.or_insert((false, Vec::new()))
363363
.1
364364
.push(feat);
@@ -377,7 +377,7 @@ impl<'r> Requirements<'r> {
377377
if self.seen(pkg) {
378378
return;
379379
}
380-
self.deps.entry(pkg.as_str()).or_insert((false, Vec::new())).0 = true;
380+
self.deps.entry(pkg).or_insert((false, Vec::new())).0 = true;
381381
}
382382

383383
fn require_feature(&mut self, feat: InternedString) -> CargoResult<()> {

0 commit comments

Comments
 (0)