Skip to content

tuple_array_conversions triggers even if individual entries are used otherwise #16192

@ronnodas

Description

@ronnodas

Summary

This is very similar to #11124, I'm not sure if it's a regression or if the issue should never have been closed. There is also a comment on that issue about the issue persisting. If a tuple or array is destructured, and the individual entries are used in other ways than just constructing the array/tuple respectively, then the lint should not trigger.

Lint Name

tuple_array_conversions

Reproducer

The example in that #11124 still triggers the lint, but here is a simplified example (playground) closer to how I encountered the false positive.

#![warn(clippy::tuple_array_conversions)]

fn do_something(tuple: (u32, u32)) {
    println!("{tuple:?}")
}

fn produce_array() -> [u32; 2] {
    [1, 2]
}

fn main() {
    let [a, b] = produce_array();
    for tuple in [(a, b), (b, a)] {
        do_something(tuple);
    }
}

Version

rustc 1.91.1 (ed61e7d7e 2025-11-07)
binary: rustc
commit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb
commit-date: 2025-11-07
host: x86_64-unknown-linux-gnu
release: 1.91.1
LLVM version: 21.1.2

(Also triggers on playground.)

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions