diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-05-29 04:49:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 04:49:42 +0200 |
| commit | eeb4fa406c7a0dee55a57194a66cdb244e1012ae (patch) | |
| tree | b061b670e8864f646336baa4641b92eb8990b2a6 /clippy_lints/src/tuple_array_conversions.rs | |
| parent | 327967c351845f6b2d0f35d6456422b6b6ca9c37 (diff) | |
| parent | 013ab6cdb116a4c194ef5ed5fdeda55e68d49fe7 (diff) | |
| download | rust-eeb4fa406c7a0dee55a57194a66cdb244e1012ae.tar.gz rust-eeb4fa406c7a0dee55a57194a66cdb244e1012ae.zip | |
Rollup merge of #141638 - oli-obk:builtin-index, r=lcnr
Use `builtin_index` instead of hand-rolling it Just using the dedicated method more
Diffstat (limited to 'clippy_lints/src/tuple_array_conversions.rs')
| -rw-r--r-- | clippy_lints/src/tuple_array_conversions.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/tuple_array_conversions.rs b/clippy_lints/src/tuple_array_conversions.rs index 95ce19975c7..3c21d194b81 100644 --- a/clippy_lints/src/tuple_array_conversions.rs +++ b/clippy_lints/src/tuple_array_conversions.rs @@ -66,7 +66,7 @@ impl LateLintPass<'_> for TupleArrayConversions { } fn check_array<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, elements: &'tcx [Expr<'tcx>]) { - let (ty::Array(ty, _) | ty::Slice(ty)) = cx.typeck_results().expr_ty(expr).kind() else { + let Some(ty) = cx.typeck_results().expr_ty(expr).builtin_index() else { unreachable!("`expr` must be an array or slice due to `ExprKind::Array`"); }; @@ -85,7 +85,7 @@ fn check_array<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, elements: & ExprKind::Path(_) => Some(elements.iter().collect()), _ => None, }) - && all_bindings_are_for_conv(cx, &[*ty], expr, elements, &locals, ToType::Array) + && all_bindings_are_for_conv(cx, &[ty], expr, elements, &locals, ToType::Array) && !is_from_proc_macro(cx, expr) { span_lint_and_help( |
