Skip to content

Commit 49d0157

Browse files
committed
fix tests and compile warning
1 parent a4dccc0 commit 49d0157

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

crates/crates-io/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ pub struct NewCrateDependency {
7777
pub artifact: Option<Vec<String>>,
7878
#[serde(skip_serializing_if = "Option::is_none")]
7979
pub bindep_target: Option<String>,
80-
#[serde(default)]
80+
#[serde(default, skip_serializing_if = "is_false")]
8181
pub lib: bool,
8282
}
8383

84+
fn is_false(&x: &bool) -> bool {
85+
!x
86+
}
87+
8488
#[derive(Deserialize)]
8589
pub struct User {
8690
pub id: u32,

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub fn build_unit_dependencies<'a, 'cfg>(
149149

150150
/// Compute all the dependencies for the standard library.
151151
fn calc_deps_of_std(
152-
mut state: &mut State<'_, '_>,
152+
state: &mut State<'_, '_>,
153153
std_roots: &HashMap<CompileKind, Vec<Unit>>,
154154
) -> CargoResult<Option<UnitGraph>> {
155155
if std_roots.is_empty() {

src/cargo/sources/registry/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ struct RegistryDependency<'a> {
365365
public: Option<bool>,
366366
artifact: Option<Vec<Cow<'a, str>>>,
367367
bindep_target: Option<Cow<'a, str>>,
368+
#[serde(default)]
368369
lib: bool,
369370
}
370371

tests/testsuite/artifact_dep.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,15 +1926,25 @@ You may press ctrl-c [..]
19261926
"badges": {},
19271927
"categories": [],
19281928
"deps": [{
1929+
"artifact": [
1930+
"bin"
1931+
],
19291932
"default_features": true,
19301933
"features": [],
19311934
"kind": "normal",
1935+
"lib": true,
19321936
"name": "bar",
19331937
"optional": false,
19341938
"target": null,
19351939
"version_req": "^1.0"
19361940
},
19371941
{
1942+
"artifact": [
1943+
"bin:a",
1944+
"cdylib",
1945+
"staticlib"
1946+
],
1947+
"bindep_target": "target",
19381948
"default_features": true,
19391949
"features": [],
19401950
"kind": "build",

0 commit comments

Comments
 (0)