about summary refs log tree commit diff
path: root/clippy_lints/src/mutable_debug_assertion.rs
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2023-07-14 13:27:56 +0200
committerPhilipp Krones <hello@philkrones.com>2023-07-14 13:36:16 +0200
commit415fdb2d1a760caf57ef9b27afbc86c030d883dd (patch)
tree6fc56398b046981977b70ce90038f3303566b161 /clippy_lints/src/mutable_debug_assertion.rs
parent660ef4ffe8d58ba236555f7c191334b82ce5025f (diff)
parentbafde54367964e9337e6a88743ad6f0299ee8c75 (diff)
downloadrust-415fdb2d1a760caf57ef9b27afbc86c030d883dd.tar.gz
rust-415fdb2d1a760caf57ef9b27afbc86c030d883dd.zip
Merge remote-tracking branch 'upstream/master' into rustup
Diffstat (limited to 'clippy_lints/src/mutable_debug_assertion.rs')
-rw-r--r--clippy_lints/src/mutable_debug_assertion.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/clippy_lints/src/mutable_debug_assertion.rs b/clippy_lints/src/mutable_debug_assertion.rs
index d8647a99105..9256119e6a4 100644
--- a/clippy_lints/src/mutable_debug_assertion.rs
+++ b/clippy_lints/src/mutable_debug_assertion.rs
@@ -39,7 +39,9 @@ declare_lint_pass!(DebugAssertWithMutCall => [DEBUG_ASSERT_WITH_MUT_CALL]);
 
 impl<'tcx> LateLintPass<'tcx> for DebugAssertWithMutCall {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
-        let Some(macro_call) = root_macro_call_first_node(cx, e) else { return };
+        let Some(macro_call) = root_macro_call_first_node(cx, e) else {
+            return;
+        };
         let macro_name = cx.tcx.item_name(macro_call.def_id);
         if !matches!(
             macro_name.as_str(),
@@ -47,7 +49,9 @@ impl<'tcx> LateLintPass<'tcx> for DebugAssertWithMutCall {
         ) {
             return;
         }
-        let Some((lhs, rhs, _)) = find_assert_eq_args(cx, e, macro_call.expn) else { return };
+        let Some((lhs, rhs, _)) = find_assert_eq_args(cx, e, macro_call.expn) else {
+            return;
+        };
         for arg in [lhs, rhs] {
             let mut visitor = MutArgVisitor::new(cx);
             visitor.visit_expr(arg);
@@ -92,10 +96,6 @@ impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
                 self.found = true;
                 return;
             },
-            ExprKind::If(..) => {
-                self.found = true;
-                return;
-            },
             ExprKind::Path(_) => {
                 if let Some(adj) = self.cx.typeck_results().adjustments().get(expr.hir_id) {
                     if adj