Skip to content

Commit a25e023

Browse files
committed
Fix invalid check-cfg Cargo feature diagnostic help
1 parent 621e241 commit a25e023

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

compiler/rustc_lint/src/context.rs

-2
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ pub trait LintContext {
804804
db.span_suggestion(value_span, "there is a expected value with a similar name", format!("\"{best_match}\""), Applicability::MaybeIncorrect);
805805

806806
}
807-
} else if name == sym::feature && is_from_cargo {
808-
db.help(format!("consider defining `{name}` as feature in `Cargo.toml`"));
809807
} else if let &[first_possibility] = &possibilities[..] {
810808
db.span_suggestion(name_span.shrink_to_hi(), "specify a config value", format!(" = \"{first_possibility}\""), Applicability::MaybeIncorrect);
811809
}

tests/ui/check-cfg/cargo-feature.some.stderr

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ warning: unexpected `cfg` condition value: (none)
1313
--> $DIR/cargo-feature.rs:18:7
1414
|
1515
LL | #[cfg(feature)]
16-
| ^^^^^^^
16+
| ^^^^^^^- help: specify a config value: `= "bitcode"`
1717
|
1818
= note: expected values for `feature` are: `bitcode`
19-
= help: consider defining `feature` as feature in `Cargo.toml`
2019
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
2120

2221
warning: unexpected `cfg` condition name: `tokio_unstable`

0 commit comments

Comments
 (0)