We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce5fa10 commit 6c1110eCopy full SHA for 6c1110e
1 file changed
clippy_lints/src/methods/suspicious_map.rs
@@ -12,7 +12,8 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, count_recv: &hi
12
if_chain! {
13
if is_trait_method(cx, count_recv, sym::Iterator);
14
let closure = expr_or_init(cx, map_arg);
15
- if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(closure.hir_id);
+ if let Some(def_id) = cx.tcx.hir().opt_local_def_id(closure.hir_id);
16
+ if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(def_id);
17
let closure_body = cx.tcx.hir().body(body_id);
18
if !cx.typeck_results().expr_ty(&closure_body.value).is_unit();
19
then {
0 commit comments