Skip to content

Commit

Permalink
fix tests and compile warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Apr 30, 2023
1 parent a4dccc0 commit 49d0157
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ pub struct NewCrateDependency {
pub artifact: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bindep_target: Option<String>,
#[serde(default)]
#[serde(default, skip_serializing_if = "is_false")]
pub lib: bool,
}

fn is_false(&x: &bool) -> bool {
!x
}

#[derive(Deserialize)]
pub struct User {
pub id: u32,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/unit_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn build_unit_dependencies<'a, 'cfg>(

/// Compute all the dependencies for the standard library.
fn calc_deps_of_std(
mut state: &mut State<'_, '_>,
state: &mut State<'_, '_>,
std_roots: &HashMap<CompileKind, Vec<Unit>>,
) -> CargoResult<Option<UnitGraph>> {
if std_roots.is_empty() {
Expand Down
1 change: 1 addition & 0 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ struct RegistryDependency<'a> {
public: Option<bool>,
artifact: Option<Vec<Cow<'a, str>>>,
bindep_target: Option<Cow<'a, str>>,
#[serde(default)]
lib: bool,
}

Expand Down
10 changes: 10 additions & 0 deletions tests/testsuite/artifact_dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1926,15 +1926,25 @@ You may press ctrl-c [..]
"badges": {},
"categories": [],
"deps": [{
"artifact": [
"bin"
],
"default_features": true,
"features": [],
"kind": "normal",
"lib": true,
"name": "bar",
"optional": false,
"target": null,
"version_req": "^1.0"
},
{
"artifact": [
"bin:a",
"cdylib",
"staticlib"
],
"bindep_target": "target",
"default_features": true,
"features": [],
"kind": "build",
Expand Down

0 comments on commit 49d0157

Please sign in to comment.