Skip to content

Commit

Permalink
Fix index override (#51)
Browse files Browse the repository at this point in the history
* Fix index override

* Fix clippy lints
  • Loading branch information
Jake-Shadle committed Nov 8, 2022
1 parent 35af9b6 commit fdeedb7
Show file tree
Hide file tree
Showing 6 changed files with 1,119 additions and 841 deletions.
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

0 comments on commit fdeedb7

Please sign in to comment.