non_local_defs: suggest removing leading ref/ptr to make the impl local
This commit is contained in:
parent
ab23fd8dea
commit
b71952904d
6 changed files with 75 additions and 34 deletions
|
@ -1338,6 +1338,7 @@ pub enum NonLocalDefinitionsDiag {
|
|||
const_anon: Option<Option<Span>>,
|
||||
move_help: Span,
|
||||
may_move: Vec<Span>,
|
||||
may_remove: Option<(Span, String)>,
|
||||
has_trait: bool,
|
||||
},
|
||||
MacroRules {
|
||||
|
@ -1361,6 +1362,7 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
|||
const_anon,
|
||||
move_help,
|
||||
may_move,
|
||||
may_remove,
|
||||
has_trait,
|
||||
} => {
|
||||
diag.primary_message(fluent::lint_non_local_definitions_impl);
|
||||
|
@ -1379,7 +1381,17 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
|||
for sp in may_move {
|
||||
ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);
|
||||
}
|
||||
diag.span_help(ms, fluent::lint_help);
|
||||
diag.span_help(ms, fluent::lint_move_help);
|
||||
|
||||
if let Some((span, part)) = may_remove {
|
||||
diag.arg("may_remove_part", part);
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
fluent::lint_remove_help,
|
||||
"",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(cargo_update) = cargo_update {
|
||||
diag.subdiagnostic(&diag.dcx, cargo_update);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue