mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Respect capped lints for dependencies
This commit is contained in:
parent
78b4afb4f3
commit
e44bde554d
@ -1148,6 +1148,13 @@ fn build_base_args(
|
||||
unit.pkg.package_id().version()
|
||||
))
|
||||
};
|
||||
let unit_capped_warn = |msg: &str| {
|
||||
if unit.show_warnings(bcx.gctx) {
|
||||
warn(msg)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
};
|
||||
|
||||
cmd.arg("--crate-name").arg(&unit.target.crate_name());
|
||||
|
||||
@ -1339,7 +1346,7 @@ fn build_base_args(
|
||||
None => None,
|
||||
Some(toml::Value::Boolean(b)) => Some(b),
|
||||
Some(v) => {
|
||||
warn(&format!(
|
||||
unit_capped_warn(&format!(
|
||||
"ignoring unsupported value type ({}) for 'hints.mostly-unused', which expects a boolean",
|
||||
v.type_str()
|
||||
))?;
|
||||
@ -1354,11 +1361,12 @@ fn build_base_args(
|
||||
cmd.arg("-Zhint-mostly-unused");
|
||||
} else {
|
||||
if profile_hint_mostly_unused.is_some() {
|
||||
// Profiles come from the top-level unit, so we don't use `unit_capped_warn` here.
|
||||
warn(
|
||||
"ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it",
|
||||
)?;
|
||||
} else if pkg_hint_mostly_unused.is_some() {
|
||||
warn(
|
||||
unit_capped_warn(
|
||||
"ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it",
|
||||
)?;
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ fn hint_unknown_type_warn() {
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||
[WARNING] foo@0.0.1: ignoring unsupported value type (string) for 'hints.mostly-unused', which expects a boolean
|
||||
[WARNING] bar@1.0.0: ignoring unsupported value type (integer) for 'hints.mostly-unused', which expects a boolean
|
||||
[CHECKING] bar v1.0.0
|
||||
[RUNNING] `rustc --crate-name bar [..]`
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
@ -178,7 +177,6 @@ fn hints_mostly_unused_warn_without_gate() {
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||
[WARNING] foo@0.0.1: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
|
||||
[WARNING] bar@1.0.0: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
|
||||
[CHECKING] bar v1.0.0
|
||||
[RUNNING] `rustc --crate-name bar [..]`
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
|
Loading…
x
Reference in New Issue
Block a user