Update unexpected_cfgs
lint for Cargo new check-cfg
config
This commit is contained in:
parent
97bf25c8cf
commit
05f77d1b79
4 changed files with 57 additions and 27 deletions
|
@ -164,13 +164,14 @@ pub(super) fn unexpected_cfg_name(
|
|||
|
||||
if is_from_cargo {
|
||||
if !is_feature_cfg {
|
||||
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
|
||||
diag.help(format!("consider using a Cargo feature instead"));
|
||||
diag.help(format!("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\"{inst}\"] }}"));
|
||||
diag.help(format!("or consider adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
|
||||
}
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration");
|
||||
} else {
|
||||
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
|
||||
pub(super) fn unexpected_cfg_value(
|
||||
|
@ -266,13 +267,14 @@ pub(super) fn unexpected_cfg_value(
|
|||
diag.help("consider defining some features in `Cargo.toml`");
|
||||
}
|
||||
} else if !is_cfg_a_well_know_name {
|
||||
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
|
||||
diag.help(format!("consider using a Cargo feature instead"));
|
||||
diag.help(format!("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\"{inst}\"] }}"));
|
||||
diag.help(format!("or consider adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
|
||||
}
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration");
|
||||
} else {
|
||||
if !is_cfg_a_well_know_name {
|
||||
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));
|
||||
}
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue