Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmease
Remove unused `#[must_use]` Self-explanatory Fixes https://github.com/rust-lang/rust/issues/145257
This commit is contained in:
@@ -2155,6 +2155,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
||||
attr_name,
|
||||
macro_name: pprust::path_to_string(&call.path),
|
||||
invoc_span: call.path.span,
|
||||
attr_span: attr.span,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -983,6 +983,7 @@ lint_unused_allocation_mut = unnecessary allocation, use `&mut` instead
|
||||
|
||||
lint_unused_builtin_attribute = unused attribute `{$attr_name}`
|
||||
.note = the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`
|
||||
.suggestion = remove the attribute
|
||||
|
||||
lint_unused_closure =
|
||||
unused {$pre}{$count ->
|
||||
|
||||
@@ -205,8 +205,14 @@ pub fn decorate_builtin_lint(
|
||||
}
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute { attr_name, macro_name, invoc_span } => {
|
||||
lints::UnusedBuiltinAttribute { invoc_span, attr_name, macro_name }.decorate_lint(diag);
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute {
|
||||
attr_name,
|
||||
macro_name,
|
||||
invoc_span,
|
||||
attr_span,
|
||||
} => {
|
||||
lints::UnusedBuiltinAttribute { invoc_span, attr_name, macro_name, attr_span }
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::TrailingMacro(is_trailing, name) => {
|
||||
lints::TrailingMacro { is_trailing, name }.decorate_lint(diag);
|
||||
|
||||
@@ -2938,9 +2938,10 @@ pub(crate) struct RawPrefix {
|
||||
pub(crate) struct UnusedBuiltinAttribute {
|
||||
#[note]
|
||||
pub invoc_span: Span,
|
||||
|
||||
pub attr_name: Symbol,
|
||||
pub macro_name: String,
|
||||
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
|
||||
@@ -647,6 +647,7 @@ pub enum BuiltinLintDiag {
|
||||
attr_name: Symbol,
|
||||
macro_name: String,
|
||||
invoc_span: Span,
|
||||
attr_span: Span,
|
||||
},
|
||||
PatternsInFnsWithoutBody {
|
||||
span: Span,
|
||||
|
||||
@@ -510,6 +510,7 @@ passes_must_not_suspend =
|
||||
|
||||
passes_must_use_no_effect =
|
||||
`#[must_use]` has no effect when applied to {$article} {$target}
|
||||
.suggestion = remove the attribute
|
||||
|
||||
passes_no_link =
|
||||
attribute should be applied to an `extern crate` item
|
||||
|
||||
@@ -1622,7 +1622,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr_span,
|
||||
errors::MustUseNoEffect { article, target },
|
||||
errors::MustUseNoEffect { article, target, attr_span },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -469,6 +469,8 @@ pub(crate) struct FfiConstInvalidTarget {
|
||||
pub(crate) struct MustUseNoEffect {
|
||||
pub article: &'static str,
|
||||
pub target: rustc_hir::Target,
|
||||
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
||||
Reference in New Issue
Block a user