Improve diagnostic for unexpected feature config name from Cargo

This commit is contained in:
Urgau 2023-11-19 21:41:55 +01:00
parent 9f15acec47
commit 1c37997fa7
3 changed files with 27 additions and 0 deletions

View file

@ -739,6 +739,8 @@ pub trait LintContext {
} else {
db.span_suggestion(name_span, "there is a config with a similar name", best_match, Applicability::MaybeIncorrect);
}
} else if name == sym::feature && std::env::var_os("CARGO").is_some() {
db.help("consider defining some features in `Cargo.toml`");
} else if !possibilities.is_empty() {
let mut possibilities = possibilities.iter()
.map(Symbol::as_str)