Skip to content

Commit 30a9879

Browse files
authored
Merge pull request #2888 from mikerite/refactor_lifetimename_static
Use slightly neater check for static lifetimes
2 parents b4b6e65 + dfd9e10 commit 30a9879

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clippy_lints/src/lifetimes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn check_fn_inner<'a, 'tcx>(
126126
GenericArg::Type(_) => None,
127127
});
128128
for bound in lifetimes {
129-
if bound.name.ident().name != "'static" && !bound.is_elided() {
129+
if bound.name != LifetimeName::Static && !bound.is_elided() {
130130
return;
131131
}
132132
bounds_lts.push(bound);
@@ -251,7 +251,7 @@ fn allowed_lts_from(named_generics: &[GenericParam]) -> HashSet<RefLt> {
251251

252252
fn lts_from_bounds<'a, T: Iterator<Item = &'a Lifetime>>(mut vec: Vec<RefLt>, bounds_lts: T) -> Vec<RefLt> {
253253
for lt in bounds_lts {
254-
if lt.name.ident().name != "'static" {
254+
if lt.name != LifetimeName::Static {
255255
vec.push(RefLt::Named(lt.name.ident().name));
256256
}
257257
}
@@ -282,7 +282,7 @@ impl<'v, 't> RefVisitor<'v, 't> {
282282

283283
fn record(&mut self, lifetime: &Option<Lifetime>) {
284284
if let Some(ref lt) = *lifetime {
285-
if lt.name.ident().name == "'static" {
285+
if lt.name == LifetimeName::Static {
286286
self.lts.push(RefLt::Static);
287287
} else if lt.is_elided() {
288288
self.lts.push(RefLt::Unnamed);

0 commit comments

Comments
 (0)