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

Fix index override #51

Merged
merged 2 commits into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/builder.rs
Expand Up @@ -146,8 +146,8 @@ impl From<Cmd> for cm::MetadataCommand {
let mut opts = Vec::with_capacity(
cmd.features.len()
+ cmd.other_options.len()
+ if cmd.no_default_features { 1 } else { 0 }
+ if cmd.all_features { 1 } else { 0 },
+ usize::from(cmd.no_default_features)
+ usize::from(cmd.all_features),
);

if cmd.no_default_features {
Expand Down Expand Up @@ -1491,7 +1491,11 @@ fn fix_features(index: &crates_index::Index, krate: &mut cm::Package) {
});

if let Some(features) = features {
krate.features = features.clone();
for (ikey, ivalue) in features {
if !krate.features.contains_key(ikey) {
krate.features.insert(ikey.clone(), ivalue.clone());
}
}

// The index entry features might not have the `dep:<crate>`
// used with weak features if the crate version was
Expand Down
2 changes: 1 addition & 1 deletion tests/bug.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/bug/Cargo.toml
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
conv = "=0.3.3"
las = { version = "=0.7.7", features = ["laz"] }

[dependencies.wasmtime]
version = "2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/kind.rs
Expand Up @@ -141,7 +141,7 @@ fn filters_build_and_dev() {
#[test]
fn only_b() {
let mut kb = krates::Builder::new();
kb.include_workspace_crates(&["/home/jake/code/krates/tests/ws/b/Cargo.toml"]);
kb.include_workspace_crates(["/home/jake/code/krates/tests/ws/b/Cargo.toml"]);

let grafs = build("all-features.json", kb).unwrap();
insta::assert_snapshot!(grafs.dotgraph());
Expand Down