diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 9e7e19a8df5..5cbb854be92 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -113,7 +113,7 @@ fn check_fn_inner<'a, 'tcx>( .parameters .lifetimes; for bound in bounds { - if bound.name != "'static" && !bound.is_elided() { + if bound.name.name() != "'static" && !bound.is_elided() { return; } bounds_lts.push(bound); @@ -225,7 +225,7 @@ fn allowed_lts_from(named_lts: &[LifetimeDef]) -> HashSet { let mut allowed_lts = HashSet::new(); for lt in named_lts { if lt.bounds.is_empty() { - allowed_lts.insert(RefLt::Named(lt.lifetime.name)); + allowed_lts.insert(RefLt::Named(lt.lifetime.name.name())); } } allowed_lts.insert(RefLt::Unnamed); @@ -235,8 +235,8 @@ fn allowed_lts_from(named_lts: &[LifetimeDef]) -> HashSet { fn lts_from_bounds<'a, T: Iterator>(mut vec: Vec, bounds_lts: T) -> Vec { for lt in bounds_lts { - if lt.name != "'static" { - vec.push(RefLt::Named(lt.name)); + if lt.name.name() != "'static" { + vec.push(RefLt::Named(lt.name.name())); } } @@ -266,12 +266,12 @@ impl<'v, 't> RefVisitor<'v, 't> { fn record(&mut self, lifetime: &Option) { if let Some(ref lt) = *lifetime { - if lt.name == "'static" { + if lt.name.name() == "'static" { self.lts.push(RefLt::Static); } else if lt.is_elided() { self.lts.push(RefLt::Unnamed); } else { - self.lts.push(RefLt::Named(lt.name)); + self.lts.push(RefLt::Named(lt.name.name())); } } else { self.lts.push(RefLt::Unnamed); @@ -396,7 +396,7 @@ struct LifetimeChecker { impl<'tcx> Visitor<'tcx> for LifetimeChecker { // for lifetimes as parameters of generics fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { - self.map.remove(&lifetime.name); + self.map.remove(&lifetime.name.name()); } fn visit_lifetime_def(&mut self, _: &'tcx LifetimeDef) { @@ -415,7 +415,7 @@ fn report_extra_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, func: &'tcx let hs = generics .lifetimes .iter() - .map(|lt| (lt.lifetime.name, lt.lifetime.span)) + .map(|lt| (lt.lifetime.name.name(), lt.lifetime.span)) .collect(); let mut checker = LifetimeChecker { map: hs }; @@ -434,7 +434,7 @@ struct BodyLifetimeChecker { impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker { // for lifetimes as parameters of generics fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { - if lifetime.name != keywords::Invalid.name() && lifetime.name != "'static" { + if lifetime.name.name() != keywords::Invalid.name() && lifetime.name.name() != "'static" { self.lifetimes_used_in_body = true; } } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 567e8b5423e..90f1e87796d 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -223,7 +223,7 @@ fn check_ty(cx: &LateContext, ast_ty: &hir::Ty, is_local: bool) { let ltopt = if lt.is_elided() { "".to_owned() } else { - format!("{} ", lt.name.as_str()) + format!("{} ", lt.name.name().as_str()) }; let mutopt = if *mutbl == Mutability::MutMutable { "mut "