]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/random_state.rs
Auto merge of #3627 - detrumi:use_self_local_macro, r=phansch
[rust.git] / clippy_lints / src / random_state.rs
index 02abd2e93bd7db8d62f697dd829a714a19296958..f95116c04b6d9078c902d15c0c042efe45d7bd71 100644 (file)
@@ -35,11 +35,13 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
     fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ty: &Ty) {
-        if let TyKind::Adt(_, substs) = cx.tables.node_id_to_type(ty.hir_id).sty {
-            for subst in substs {
-                if let UnpackedKind::Type(build_hasher) = subst.unpack() {
-                    if match_type(cx, build_hasher, &paths::RANDOM_STATE) {
-                        span_lint(cx, RANDOM_STATE, ty.span, "usage of RandomState");
+        if let Some(tys) = cx.tables.node_id_to_type_opt(ty.hir_id) {
+            if let TyKind::Adt(_, substs) = tys.sty {
+                for subst in substs {
+                    if let UnpackedKind::Type(build_hasher) = subst.unpack() {
+                        if match_type(cx, build_hasher, &paths::RANDOM_STATE) {
+                            span_lint(cx, RANDOM_STATE, ty.span, "usage of RandomState");
+                        }
                     }
                 }
             }