1
Fork 0

Only suggest #[allow] for --warn and --deny lint level flags

This commit is contained in:
Alex Macleod 2024-08-08 13:09:58 +00:00
parent d3a393932e
commit 9289f5691b
8 changed files with 5 additions and 10 deletions

View file

@ -228,9 +228,11 @@ pub fn explain_lint_level_source(
err.note_once(format!(
"`{flag} {hyphen_case_lint_name}` implied by `{flag} {hyphen_case_flag_val}`"
));
err.help_once(format!(
"to override `{flag} {hyphen_case_flag_val}` add `#[allow({name})]`"
));
if matches!(orig_level, Level::Warn | Level::Deny) {
err.help_once(format!(
"to override `{flag} {hyphen_case_flag_val}` add `#[allow({name})]`"
));
}
}
}
LintLevelSource::Node { name: lint_attr_name, span, reason, .. } => {