diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-05-26 10:38:02 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-05-28 10:03:01 +0000 |
| commit | 013ab6cdb116a4c194ef5ed5fdeda55e68d49fe7 (patch) | |
| tree | e72116ad86c102162033fc4122fbff41b8e9cdaf /clippy_lints/src/tuple_array_conversions.rs | |
| parent | ce0adf08c9c08a770fa65c98cdb59335d4acee3d (diff) | |
| download | rust-013ab6cdb116a4c194ef5ed5fdeda55e68d49fe7.tar.gz rust-013ab6cdb116a4c194ef5ed5fdeda55e68d49fe7.zip | |
Use `builin_index` instead of hand-rolling it
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( |
