Skip to content

Commit 94611b8

Browse files
committed
Avoid ICE when fetching LocalDefId
Signed-off-by: Miguel Guarniz <[email protected]>
1 parent 0c609a4 commit 94611b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, count_recv: &hi
1212
if_chain! {
1313
if is_trait_method(cx, count_recv, sym::Iterator);
1414
let closure = expr_or_init(cx, map_arg);
15-
if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(closure.hir_id);
15+
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);
1617
let closure_body = cx.tcx.hir().body(body_id);
1718
if !cx.typeck_results().expr_ty(&closure_body.value).is_unit();
1819
then {

0 commit comments

Comments
 (0)