From ac87b0cb73dc16df9413421119100001bf370d20 Mon Sep 17 00:00:00 2001 From: lapla-cogito Date: Thu, 23 Jan 2025 12:40:12 +0900 Subject: [PATCH] fix ICE in `unnecessary_mut_passed` --- clippy_lints/src/mut_reference.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index c382fb8fce1b..2fd1049f42e1 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -54,8 +54,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMutPassed { ); } }, - ExprKind::MethodCall(path, receiver, arguments, _) => { - let def_id = cx.typeck_results().type_dependent_def_id(e.hir_id).unwrap(); + ExprKind::MethodCall(path, receiver, arguments, _) + if let Some(def_id) = cx.typeck_results().type_dependent_def_id(e.hir_id) => + { let args = cx.typeck_results().node_args(e.hir_id); let method_type = cx.tcx.type_of(def_id).instantiate(cx.tcx, args); check_arguments(