about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/reachable.rs8
-rw-r--r--compiler/rustc_passes/src/stability.rs16
-rw-r--r--compiler/rustc_passes/src/upvars.rs26
3 files changed, 25 insertions, 25 deletions
diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs
index b49e8118fe3..2f78c22c748 100644
--- a/compiler/rustc_passes/src/reachable.rs
+++ b/compiler/rustc_passes/src/reachable.rs
@@ -104,10 +104,10 @@ impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> {
 
     fn visit_inline_asm(&mut self, asm: &'tcx hir::InlineAsm<'tcx>, id: hir::HirId) {
         for (op, _) in asm.operands {
-            if let hir::InlineAsmOperand::SymStatic { def_id, .. } = op {
-                if let Some(def_id) = def_id.as_local() {
-                    self.reachable_symbols.insert(def_id);
-                }
+            if let hir::InlineAsmOperand::SymStatic { def_id, .. } = op
+                && let Some(def_id) = def_id.as_local()
+            {
+                self.reachable_symbols.insert(def_id);
             }
         }
         intravisit::walk_inline_asm(self, asm, id);
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 40999d622dc..9ed7293873f 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -929,10 +929,10 @@ struct CheckTraitImplStable<'tcx> {
 
 impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
     fn visit_path(&mut self, path: &hir::Path<'tcx>, _id: hir::HirId) {
-        if let Some(def_id) = path.res.opt_def_id() {
-            if let Some(stab) = self.tcx.lookup_stability(def_id) {
-                self.fully_stable &= stab.level.is_stable();
-            }
+        if let Some(def_id) = path.res.opt_def_id()
+            && let Some(stab) = self.tcx.lookup_stability(def_id)
+        {
+            self.fully_stable &= stab.level.is_stable();
         }
         intravisit::walk_path(self, path)
     }
@@ -1055,10 +1055,10 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
             // implications from this crate.
             remaining_implications.remove(&feature);
 
-            if let FeatureStability::Unstable { old_name: Some(alias) } = stability {
-                if let Some(span) = remaining_lib_features.swap_remove(&alias) {
-                    tcx.dcx().emit_err(errors::RenamedFeature { span, feature, alias });
-                }
+            if let FeatureStability::Unstable { old_name: Some(alias) } = stability
+                && let Some(span) = remaining_lib_features.swap_remove(&alias)
+            {
+                tcx.dcx().emit_err(errors::RenamedFeature { span, feature, alias });
             }
 
             if remaining_lib_features.is_empty() && remaining_implications.is_empty() {
diff --git a/compiler/rustc_passes/src/upvars.rs b/compiler/rustc_passes/src/upvars.rs
index fae88fbba36..88f202919bb 100644
--- a/compiler/rustc_passes/src/upvars.rs
+++ b/compiler/rustc_passes/src/upvars.rs
@@ -75,19 +75,19 @@ impl<'tcx> Visitor<'tcx> for CaptureCollector<'_, 'tcx> {
     }
 
     fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
-        if let hir::ExprKind::Closure(closure) = expr.kind {
-            if let Some(upvars) = self.tcx.upvars_mentioned(closure.def_id) {
-                // Every capture of a closure expression is a local in scope,
-                // that is moved/copied/borrowed into the closure value, and
-                // for this analysis they are like any other access to a local.
-                //
-                // E.g. in `|b| |c| (a, b, c)`, the upvars of the inner closure
-                // are `a` and `b`, and while `a` is not directly used in the
-                // outer closure, it needs to be an upvar there too, so that
-                // the inner closure can take it (from the outer closure's env).
-                for (&var_id, upvar) in upvars {
-                    self.visit_local_use(var_id, upvar.span);
-                }
+        if let hir::ExprKind::Closure(closure) = expr.kind
+            && let Some(upvars) = self.tcx.upvars_mentioned(closure.def_id)
+        {
+            // Every capture of a closure expression is a local in scope,
+            // that is moved/copied/borrowed into the closure value, and
+            // for this analysis they are like any other access to a local.
+            //
+            // E.g. in `|b| |c| (a, b, c)`, the upvars of the inner closure
+            // are `a` and `b`, and while `a` is not directly used in the
+            // outer closure, it needs to be an upvar there too, so that
+            // the inner closure can take it (from the outer closure's env).
+            for (&var_id, upvar) in upvars {
+                self.visit_local_use(var_id, upvar.span);
             }
         }