RS.CLIPPY.TUPLE_ARRAY_CONVERSIONS

Checks for tuple<=>array conversions that are not done with `.into()`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: tuple_array_conversions. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for tuple<=>array conversions that are not done with .into().

Why is this bad?

It may be unnecessary complexity. .into() works for converting tuples<=> arrays of up to 12 elements and conveys the intent more clearly, while also leaving less room for hard to spot bugs!

Known issues

The suggested code may hide potential asymmetry in some cases. See #11085 for more info.

Example

let t1 = &[(1, 2), (3, 4)];
let v1: Vec<[u32; 2]> = t1.iter().map(|&(a, b)| [a, b]).collect();

Use instead:

let t1 = &[(1, 2), (3, 4)];
let v1: Vec<[u32; 2]> = t1.iter().map(|&t| t.into()).collect();

Configuration

  • msrv: The minimum rust version that the project supports. Defaults to the rust-version field in Cargo.toml

    (default: current version)