fix confusing diagnostic for reserved ##
This commit is contained in:
parent
7db7489f9b
commit
44f4f67f46
14 changed files with 141 additions and 107 deletions
|
@ -176,8 +176,12 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
lints::RawPrefix { label: label_span, suggestion: label_span.shrink_to_hi() }
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::ReservedString(suggestion) => {
|
||||
lints::ReservedString { suggestion }.decorate_lint(diag);
|
||||
BuiltinLintDiag::ReservedString { is_string, suggestion } => {
|
||||
if is_string {
|
||||
lints::ReservedString { suggestion }.decorate_lint(diag);
|
||||
} else {
|
||||
lints::ReservedMultihash { suggestion }.decorate_lint(diag);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute { attr_name, macro_name, invoc_span } => {
|
||||
lints::UnusedBuiltinAttribute { invoc_span, attr_name, macro_name }.decorate_lint(diag);
|
||||
|
|
|
@ -3059,3 +3059,10 @@ pub(crate) struct ReservedString {
|
|||
#[suggestion(code = " ", applicability = "machine-applicable")]
|
||||
pub suggestion: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_reserved_multihash)]
|
||||
pub(crate) struct ReservedMultihash {
|
||||
#[suggestion(code = " ", applicability = "machine-applicable")]
|
||||
pub suggestion: Span,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue