Skip to content

Commit

Permalink
tweek names to be clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Jun 19, 2024
1 parent 939a114 commit 85f6d2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cargo/core/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn build_feature_map(
let explicitly_listed: HashSet<_> = map
.values()
.flatten()
.filter_map(|fv| fv.explicitly_name())
.filter_map(|fv| fv.explicit_dep_name())
.collect();
for dep in dependencies {
if !dep.is_optional() {
Expand All @@ -198,7 +198,7 @@ fn build_feature_map(
FeatureName::new(feature)?;
for fv in fvs {
// Find data for the referenced dependency...
let dep_data = dep_map.get(&fv.dep_name());
let dep_data = dep_map.get(&fv.feature_or_dep_name());
let is_any_dep = dep_data.is_some();
let is_optional_dep = dep_data.is_some_and(|&o| o);
match fv {
Expand Down Expand Up @@ -351,14 +351,15 @@ impl FeatureValue {
}
}

fn explicitly_name(&self) -> Option<InternedString> {
/// Returns the name of the dependency if and only if it was explicitly named with the `dep:` syntax.
fn explicit_dep_name(&self) -> Option<InternedString> {
match self {
FeatureValue::Dep { dep_name, .. } => Some(*dep_name),
_ => None,
}
}

fn dep_name(&self) -> InternedString {
fn feature_or_dep_name(&self) -> InternedString {
match self {
FeatureValue::Feature(dep_name)
| FeatureValue::Dep { dep_name, .. }
Expand Down

0 comments on commit 85f6d2d

Please sign in to comment.