about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-10-05 22:35:04 -0700
committerGitHub <noreply@github.com>2018-10-05 22:35:04 -0700
commit32b1d1fc157f71ed2f10b60fe28abe087a743618 (patch)
treea03144d8facf8a7cec24ea418fc86016eb3945e0
parentcbde8201c5f5d56c3bea9aa328a61f71a805138f (diff)
parent53d41e5c504b8dd535c25aaf2f0008fa525cbb9d (diff)
downloadrust-32b1d1fc157f71ed2f10b60fe28abe087a743618.tar.gz
rust-32b1d1fc157f71ed2f10b60fe28abe087a743618.zip
Merge pull request #3270 from rust-lang-nursery/rustup
Rustup for https://github.com/rust-lang/rust/pull/54741
-rw-r--r--clippy_lints/src/lifetimes.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs
index 62e308bb585..dbd433bc909 100644
--- a/clippy_lints/src/lifetimes.rs
+++ b/clippy_lints/src/lifetimes.rs
@@ -344,23 +344,20 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
                 self.record(&None);
             },
             TyKind::Path(ref path) => {
-                if let QPath::Resolved(_, ref path) = *path {
-                    if let Def::Existential(def_id) = path.def {
-                        let node_id = self.cx.tcx.hir.as_local_node_id(def_id).unwrap();
-                        if let ItemKind::Existential(ref exist_ty) = self.cx.tcx.hir.expect_item(node_id).node {
-                            for bound in &exist_ty.bounds {
-                                if let GenericBound::Outlives(_) = *bound {
-                                    self.record(&None);
-                                }
-                            }
-                        } else {
-                            unreachable!()
+
+                self.collect_anonymous_lifetimes(path, ty);
+            }
+            TyKind::Def(item, _) => {
+                if let ItemKind::Existential(ref exist_ty) = self.cx.tcx.hir.expect_item(item.id).node {
+                    for bound in &exist_ty.bounds {
+                        if let GenericBound::Outlives(_) = *bound {
+                            self.record(&None);
                         }
-                        walk_ty(self, ty);
-                        return;
                     }
+                } else {
+                    unreachable!()
                 }
-                self.collect_anonymous_lifetimes(path, ty);
+                walk_ty(self, ty);
             }
             TyKind::TraitObject(ref bounds, ref lt) => {
                 if !lt.is_elided() {