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

silly fix, pointer to the empty slice #10097

Merged
merged 1 commit into from
Nov 18, 2021
Merged
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
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