]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/internal.rs
Rollup merge of #70762 - RalfJung:miri-leak-check, r=oli-obk
[rust.git] / src / librustc_lint / internal.rs
index d8c685f2b22ffe908423d1c428574e353bb02124..6de8fb45d223d80e6e8eb37f63a4d2789906b282 100644 (file)
@@ -175,18 +175,15 @@ fn lint_ty_kind_usage(cx: &LateContext<'_, '_>, segment: &PathSegment<'_>) -> bo
 }
 
 fn is_ty_or_ty_ctxt(cx: &LateContext<'_, '_>, ty: &Ty<'_>) -> Option<String> {
-    match &ty.kind {
-        TyKind::Path(qpath) => {
-            if let QPath::Resolved(_, path) = qpath {
-                let did = path.res.opt_def_id()?;
-                if cx.tcx.is_diagnostic_item(sym::Ty, did) {
-                    return Some(format!("Ty{}", gen_args(path.segments.last().unwrap())));
-                } else if cx.tcx.is_diagnostic_item(sym::TyCtxt, did) {
-                    return Some(format!("TyCtxt{}", gen_args(path.segments.last().unwrap())));
-                }
+    if let TyKind::Path(qpath) = &ty.kind {
+        if let QPath::Resolved(_, path) = qpath {
+            let did = path.res.opt_def_id()?;
+            if cx.tcx.is_diagnostic_item(sym::Ty, did) {
+                return Some(format!("Ty{}", gen_args(path.segments.last().unwrap())));
+            } else if cx.tcx.is_diagnostic_item(sym::TyCtxt, did) {
+                return Some(format!("TyCtxt{}", gen_args(path.segments.last().unwrap())));
             }
         }
-        _ => {}
     }
 
     None