elided_named_lifetimes: unify lint def & pass MissingLifetimeKind
This commit is contained in:
parent
a3af2085cc
commit
e38764d73b
3 changed files with 33 additions and 21 deletions
|
@ -8,7 +8,7 @@ use rustc_errors::{
|
|||
elided_lifetime_in_path_suggestion, Applicability, Diag, DiagArgValue, LintDiagnostic,
|
||||
};
|
||||
use rustc_middle::middle::stability;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::lint::{BuiltinLintDiag, ElidedLifetimeResolution};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::BytePos;
|
||||
|
@ -442,15 +442,18 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
BuiltinLintDiag::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by } => {
|
||||
lints::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by }.decorate_lint(diag)
|
||||
}
|
||||
BuiltinLintDiag::ElidedIsStatic { elided } => {
|
||||
lints::ElidedNamedLifetime { elided, name: kw::StaticLifetime, named_declaration: None }
|
||||
.decorate_lint(diag)
|
||||
}
|
||||
BuiltinLintDiag::ElidedIsParam { elided, param: (param_name, param_span) } => {
|
||||
lints::ElidedNamedLifetime {
|
||||
elided,
|
||||
name: param_name,
|
||||
named_declaration: Some(param_span),
|
||||
BuiltinLintDiag::ElidedNamedLifetimes { elided: (elided, _kind), resolution } => {
|
||||
match resolution {
|
||||
ElidedLifetimeResolution::Static => lints::ElidedNamedLifetime {
|
||||
elided,
|
||||
name: kw::StaticLifetime,
|
||||
named_declaration: None,
|
||||
},
|
||||
ElidedLifetimeResolution::Param(name, declaration) => lints::ElidedNamedLifetime {
|
||||
elided,
|
||||
name,
|
||||
named_declaration: Some(declaration),
|
||||
},
|
||||
}
|
||||
.decorate_lint(diag)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue