From: Michael Wright Date: Sun, 1 Jul 2018 09:58:29 +0000 (+0200) Subject: Use slightly neater check for static lifetimes X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=dfd9e10a2a0213e99435438e7cffdc930c8464ad;p=rust.git Use slightly neater check for static lifetimes --- diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index efa50a8f743..3fbbb4daee8 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -126,7 +126,7 @@ fn check_fn_inner<'a, 'tcx>( GenericArg::Type(_) => None, }); for bound in lifetimes { - if bound.name.ident().name != "'static" && !bound.is_elided() { + if bound.name != LifetimeName::Static && !bound.is_elided() { return; } bounds_lts.push(bound); @@ -251,7 +251,7 @@ fn allowed_lts_from(named_generics: &[GenericParam]) -> HashSet { fn lts_from_bounds<'a, T: Iterator>(mut vec: Vec, bounds_lts: T) -> Vec { for lt in bounds_lts { - if lt.name.ident().name != "'static" { + if lt.name != LifetimeName::Static { vec.push(RefLt::Named(lt.name.ident().name)); } } @@ -282,7 +282,7 @@ fn new(cx: &'v LateContext<'v, 't>) -> Self { fn record(&mut self, lifetime: &Option) { if let Some(ref lt) = *lifetime { - if lt.name.ident().name == "'static" { + if lt.name == LifetimeName::Static { self.lts.push(RefLt::Static); } else if lt.is_elided() { self.lts.push(RefLt::Unnamed);