Lint elided lifetimes in path on the AST.
This commit is contained in:
parent
ca57bada05
commit
a9e13fa553
24 changed files with 279 additions and 154 deletions
|
@ -95,7 +95,7 @@ pub enum LifetimeName {
|
|||
/// User wrote nothing (e.g., the lifetime in `&u32`).
|
||||
///
|
||||
/// The bool indicates whether the user should have written something.
|
||||
Implicit(bool),
|
||||
Implicit,
|
||||
|
||||
/// Implicit lifetime in a context like `dyn Foo`. This is
|
||||
/// distinguished from implicit lifetimes elsewhere because the
|
||||
|
@ -125,7 +125,7 @@ impl LifetimeName {
|
|||
pub fn ident(&self) -> Ident {
|
||||
match *self {
|
||||
LifetimeName::ImplicitObjectLifetimeDefault
|
||||
| LifetimeName::Implicit(_)
|
||||
| LifetimeName::Implicit
|
||||
| LifetimeName::Error => Ident::empty(),
|
||||
LifetimeName::Underscore => Ident::with_dummy_span(kw::UnderscoreLifetime),
|
||||
LifetimeName::Static => Ident::with_dummy_span(kw::StaticLifetime),
|
||||
|
@ -136,7 +136,7 @@ impl LifetimeName {
|
|||
pub fn is_elided(&self) -> bool {
|
||||
match self {
|
||||
LifetimeName::ImplicitObjectLifetimeDefault
|
||||
| LifetimeName::Implicit(_)
|
||||
| LifetimeName::Implicit
|
||||
| LifetimeName::Underscore => true,
|
||||
|
||||
// It might seem surprising that `Fresh(_)` counts as
|
||||
|
|
|
@ -528,7 +528,7 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
|
|||
| LifetimeName::Param(ParamName::Error)
|
||||
| LifetimeName::Static
|
||||
| LifetimeName::Error
|
||||
| LifetimeName::Implicit(_)
|
||||
| LifetimeName::Implicit
|
||||
| LifetimeName::ImplicitObjectLifetimeDefault
|
||||
| LifetimeName::Underscore => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue