mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Fix rustup fallout: lifetimes false positives
This commit is contained in:
parent
4fc17e7faf
commit
f76f4d52c2
2 changed files with 14 additions and 0 deletions
|
@ -89,6 +89,9 @@ fn could_use_elision(func: &FnDecl, slf: Option<&ExplicitSelf>,
|
|||
// extract lifetimes in input argument types
|
||||
for arg in &func.inputs {
|
||||
walk_ty(&mut input_visitor, &arg.ty);
|
||||
if let TyRptr(None, _) = arg.ty.node {
|
||||
input_visitor.record(&None);
|
||||
}
|
||||
}
|
||||
// extract lifetimes in output type
|
||||
if let Return(ref ty) = func.output {
|
||||
|
@ -181,6 +184,13 @@ impl<'v> Visitor<'v> for RefVisitor {
|
|||
fn visit_lifetime(&mut self, lifetime: &'v Lifetime) {
|
||||
self.record(&Some(*lifetime));
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &'v Ty) {
|
||||
if let TyRptr(None, _) = ty.node {
|
||||
self.record(&None);
|
||||
}
|
||||
walk_ty(self, ty);
|
||||
}
|
||||
}
|
||||
|
||||
/// Are any lifetimes mentioned in the `where` clause? If yes, we don't try to
|
||||
|
|
|
@ -81,5 +81,9 @@ impl<'a> Foo<'a> {
|
|||
fn self_bound_lifetime<'b: 'a>(&self, _: &'b u8) {} // no error, bounds exist
|
||||
}
|
||||
|
||||
fn already_elided<'a>(_: &u8, _: &'a u8) -> &'a u8 {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue