]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/utils/hir_utils.rs
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / utils / hir_utils.rs
index ae58f0a1521e69bf3ff32f7ae4e7cdd2cb1676b2..34341594c1985ef41a7a48b84198fad986c59233 100644 (file)
@@ -703,6 +703,7 @@ pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
                     }
                     for segment in path.segments {
                         segment.ident.name.hash(&mut self.s);
+                        self.hash_generic_args(segment.generic_args().args);
                     }
                 },
                 QPath::TypeRelative(ref ty, ref segment) => {
@@ -711,13 +712,7 @@ pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
                 },
             },
             TyKind::OpaqueDef(_, arg_list) => {
-                for arg in *arg_list {
-                    match arg {
-                        GenericArg::Lifetime(ref l) => self.hash_lifetime(l),
-                        GenericArg::Type(ref ty) => self.hash_ty(&ty),
-                        GenericArg::Const(ref ca) => self.hash_body(ca.value.body),
-                    }
-                }
+                self.hash_generic_args(arg_list);
             },
             TyKind::TraitObject(_, lifetime) => {
                 self.hash_lifetime(lifetime);
@@ -735,4 +730,14 @@ pub fn hash_body(&mut self, body_id: BodyId) {
         self.hash_expr(&self.cx.tcx.hir().body(body_id).value);
         self.maybe_typeck_tables = old_maybe_typeck_tables;
     }
+
+    fn hash_generic_args(&mut self, arg_list: &[GenericArg<'_>]) {
+        for arg in arg_list {
+            match arg {
+                GenericArg::Lifetime(ref l) => self.hash_lifetime(l),
+                GenericArg::Type(ref ty) => self.hash_ty(&ty),
+                GenericArg::Const(ref ca) => self.hash_body(ca.value.body),
+            }
+        }
+    }
 }