diff --git a/clippy_lints/src/tuple_array_conversions.rs b/clippy_lints/src/tuple_array_conversions.rs index 78ad52d8a87..c12519d723c 100644 --- a/clippy_lints/src/tuple_array_conversions.rs +++ b/clippy_lints/src/tuple_array_conversions.rs @@ -189,8 +189,8 @@ fn all_bindings_are_for_conv<'tcx>( tys.len() == elements.len() && tys.iter().chain(final_tys.iter().copied()).all_equal() }, (ToType::Tuple, ty::Array(ty, len)) => { - len.eval_target_usize(cx.tcx, cx.param_env) as usize == elements.len() - && final_tys.iter().chain(once(ty)).all_equal() + let Some(len) = len.try_eval_target_usize(cx.tcx, cx.param_env) else { return false }; + len as usize == elements.len() && final_tys.iter().chain(once(ty)).all_equal() }, _ => false, }