Skip to content

Commit

Permalink
silly fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Nov 18, 2021
1 parent ad50d0d commit 2f7009f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/cargo/core/resolver/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ pub struct Resolve {
replacements: HashMap<PackageId, PackageId>,
/// Inverted version of `replacements`.
reverse_replacements: HashMap<PackageId, PackageId>,
/// An empty `Vec` to avoid creating a new `Vec` for every package
/// that does not have any features, and to avoid using `Option` to
/// simplify the API.
empty_features: Vec<InternedString>,
/// Features enabled for a given package.
features: HashMap<PackageId, Vec<InternedString>>,
/// Checksum for each package. A SHA256 hash of the `.crate` file used to
Expand Down Expand Up @@ -107,7 +103,6 @@ impl Resolve {
checksums,
metadata,
unused_patches,
empty_features: Vec::new(),
reverse_replacements,
public_dependencies,
version,
Expand Down Expand Up @@ -264,7 +259,7 @@ unable to verify that `{0}` is the same as when the lockfile was generated
}

pub fn features(&self, pkg: PackageId) -> &[InternedString] {
self.features.get(&pkg).unwrap_or(&self.empty_features)
self.features.get(&pkg).map(|v| &**v).unwrap_or(&[])
}

/// This is only here for legacy support, it will be removed when
Expand Down Expand Up @@ -377,7 +372,7 @@ impl PartialEq for Resolve {
}
compare! {
// fields to compare
graph replacements reverse_replacements empty_features features
graph replacements reverse_replacements features
checksums metadata unused_patches public_dependencies summaries
|
// fields to ignore
Expand Down

0 comments on commit 2f7009f

Please sign in to comment.