about summary refs log tree commit diff
diff options
context:
space:
mode:
authortogami2864 <tuabobo123@gmail.com>2021-11-16 03:02:08 +0900
committertogami2864 <tuabobo123@gmail.com>2021-11-16 03:02:08 +0900
commit0a30fdcd3c5ab9803983671a4452dff7e31f9e80 (patch)
treebbe4861f2c36f0d7eeb70f644215139825a7ae3e
parent300282c09aa8e922699b4fc7e2c608b4f8d81719 (diff)
downloadrust-0a30fdcd3c5ab9803983671a4452dff7e31f9e80.tar.gz
rust-0a30fdcd3c5ab9803983671a4452dff7e31f9e80.zip
move the let statement out of the macro
-rw-r--r--clippy_lints/src/methods/option_map_or_none.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/methods/option_map_or_none.rs b/clippy_lints/src/methods/option_map_or_none.rs
index 3a93d912e8c..12ccaa24c3b 100644
--- a/clippy_lints/src/methods/option_map_or_none.rs
+++ b/clippy_lints/src/methods/option_map_or_none.rs
@@ -74,8 +74,8 @@ pub(super) fn check<'tcx>(
         let self_snippet = snippet(cx, recv.span, "..");
         if let hir::ExprKind::Closure(_, _, id, span, _) = map_arg.kind {
             let arg_snippet = snippet(cx, span, "..");
+            let body = cx.tcx.hir().body(id);
             if_chain! {
-                let body = cx.tcx.hir().body(id);
                 if let Some((func, arg_char)) = reduce_unit_expression(cx, &body.value);
                 if arg_char.len() == 1;
                 if let hir::ExprKind::Path(ref qpath) = func.kind;