Warn on elided lifetimes in associated constants

This commit is contained in:
Michael Goulet 2023-08-19 23:27:50 +00:00
parent 6ef7d16be0
commit fad7d220fd
8 changed files with 178 additions and 25 deletions

View file

@ -966,6 +966,14 @@ pub trait LintContext: Sized {
Applicability::MachineApplicable
);
}
BuiltinLintDiagnostics::AssociatedConstElidedLifetime { elided, span } => {
db.span_suggestion_verbose(
if elided { span.shrink_to_hi() } else { span },
"use the `'static` lifetime",
if elided { "'static " } else { "'static" },
Applicability::MachineApplicable
);
}
}
// Rewrap `db`, and pass control to the user.
decorate(db)