mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Correct formatting with cargo fmt
This commit is contained in:
parent
008c369084
commit
90954d700c
@ -213,7 +213,6 @@ pub fn resolve_with_previous<'a, 'cfg>(
|
|||||||
registry.lock_patches();
|
registry.lock_patches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for member in ws.members() {
|
for member in ws.members() {
|
||||||
registry.add_sources(&[member.package_id().source_id().clone()])?;
|
registry.add_sources(&[member.package_id().source_id().clone()])?;
|
||||||
}
|
}
|
||||||
@ -223,12 +222,18 @@ pub fn resolve_with_previous<'a, 'cfg>(
|
|||||||
let mut members = Vec::new();
|
let mut members = Vec::new();
|
||||||
match method {
|
match method {
|
||||||
Method::Everything => members.extend(ws.members()),
|
Method::Everything => members.extend(ws.members()),
|
||||||
Method::Required { features, all_features, uses_default_features, .. } => {
|
Method::Required {
|
||||||
|
features,
|
||||||
|
all_features,
|
||||||
|
uses_default_features,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
if specs.len() > 1 && !features.is_empty() {
|
if specs.len() > 1 && !features.is_empty() {
|
||||||
bail!("cannot specify features for more than one package");
|
bail!("cannot specify features for more than one package");
|
||||||
}
|
}
|
||||||
members.extend(
|
members.extend(
|
||||||
ws.members().filter(|m| specs.iter().any(|spec| spec.matches(m.package_id())))
|
ws.members()
|
||||||
|
.filter(|m| specs.iter().any(|spec| spec.matches(m.package_id()))),
|
||||||
);
|
);
|
||||||
// Edge case: running `cargo build -p foo`, where `foo` is not a member
|
// Edge case: running `cargo build -p foo`, where `foo` is not a member
|
||||||
// of current workspace. Add all packages from workspace to get `foo`
|
// of current workspace. Add all packages from workspace to get `foo`
|
||||||
@ -293,7 +298,6 @@ pub fn resolve_with_previous<'a, 'cfg>(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let root_replace = ws.root_replace();
|
let root_replace = ws.root_replace();
|
||||||
|
|
||||||
let replace = match previous {
|
let replace = match previous {
|
||||||
|
@ -1664,39 +1664,46 @@ fn combining_features_and_package() {
|
|||||||
main = []
|
main = []
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("foo/src/main.rs", r#"
|
.file(
|
||||||
|
"foo/src/main.rs",
|
||||||
|
r#"
|
||||||
#[cfg(feature = "main")]
|
#[cfg(feature = "main")]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
"#)
|
"#,
|
||||||
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build -Z package-features --all --features main")
|
p.cargo("build -Z package-features --all --features main")
|
||||||
.masquerade_as_nightly_cargo(),
|
.masquerade_as_nightly_cargo(),
|
||||||
execs().with_status(101).with_stderr_contains("\
|
execs().with_status(101).with_stderr_contains(
|
||||||
[ERROR] cannot specify features for more than one package"
|
"\
|
||||||
|
[ERROR] cannot specify features for more than one package",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build -Z package-features --package dep --features main")
|
p.cargo("build -Z package-features --package dep --features main")
|
||||||
.masquerade_as_nightly_cargo(),
|
.masquerade_as_nightly_cargo(),
|
||||||
execs().with_status(101).with_stderr_contains("\
|
execs().with_status(101).with_stderr_contains(
|
||||||
[ERROR] cannot specify features for packages outside of workspace"
|
"\
|
||||||
|
[ERROR] cannot specify features for packages outside of workspace",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build -Z package-features --package dep --all-features")
|
p.cargo("build -Z package-features --package dep --all-features")
|
||||||
.masquerade_as_nightly_cargo(),
|
.masquerade_as_nightly_cargo(),
|
||||||
execs().with_status(101).with_stderr_contains("\
|
execs().with_status(101).with_stderr_contains(
|
||||||
[ERROR] cannot specify features for packages outside of workspace"
|
"\
|
||||||
|
[ERROR] cannot specify features for packages outside of workspace",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build -Z package-features --package dep --no-default-features")
|
p.cargo("build -Z package-features --package dep --no-default-features")
|
||||||
.masquerade_as_nightly_cargo(),
|
.masquerade_as_nightly_cargo(),
|
||||||
execs().with_status(101).with_stderr_contains("\
|
execs().with_status(101).with_stderr_contains(
|
||||||
[ERROR] cannot specify features for packages outside of workspace"
|
"\
|
||||||
|
[ERROR] cannot specify features for packages outside of workspace",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user