mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
Use slightly neater check for static lifetimes
This commit is contained in:
parent
b4b6e6558e
commit
dfd9e10a2a
@ -126,7 +126,7 @@ fn check_fn_inner<'a, 'tcx>(
|
|||||||
GenericArg::Type(_) => None,
|
GenericArg::Type(_) => None,
|
||||||
});
|
});
|
||||||
for bound in lifetimes {
|
for bound in lifetimes {
|
||||||
if bound.name.ident().name != "'static" && !bound.is_elided() {
|
if bound.name != LifetimeName::Static && !bound.is_elided() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bounds_lts.push(bound);
|
bounds_lts.push(bound);
|
||||||
@ -251,7 +251,7 @@ fn allowed_lts_from(named_generics: &[GenericParam]) -> HashSet<RefLt> {
|
|||||||
|
|
||||||
fn lts_from_bounds<'a, T: Iterator<Item = &'a Lifetime>>(mut vec: Vec<RefLt>, bounds_lts: T) -> Vec<RefLt> {
|
fn lts_from_bounds<'a, T: Iterator<Item = &'a Lifetime>>(mut vec: Vec<RefLt>, bounds_lts: T) -> Vec<RefLt> {
|
||||||
for lt in bounds_lts {
|
for lt in bounds_lts {
|
||||||
if lt.name.ident().name != "'static" {
|
if lt.name != LifetimeName::Static {
|
||||||
vec.push(RefLt::Named(lt.name.ident().name));
|
vec.push(RefLt::Named(lt.name.ident().name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ impl<'v, 't> RefVisitor<'v, 't> {
|
|||||||
|
|
||||||
fn record(&mut self, lifetime: &Option<Lifetime>) {
|
fn record(&mut self, lifetime: &Option<Lifetime>) {
|
||||||
if let Some(ref lt) = *lifetime {
|
if let Some(ref lt) = *lifetime {
|
||||||
if lt.name.ident().name == "'static" {
|
if lt.name == LifetimeName::Static {
|
||||||
self.lts.push(RefLt::Static);
|
self.lts.push(RefLt::Static);
|
||||||
} else if lt.is_elided() {
|
} else if lt.is_elided() {
|
||||||
self.lts.push(RefLt::Unnamed);
|
self.lts.push(RefLt::Unnamed);
|
||||||
|
Loading…
Reference in New Issue
Block a user