Skip to content

#[must_use] does not warn for unused must_use tuple components #26291

Closed
@nagisa

Description

@nagisa
#[must_use]
struct MU;

fn a() -> (u8, MU) {
    (0, MU)
}

pub fn main() {
    a(); // does not warn
    a().1; // warns
    a().0; // does not warn
}

I believe it should warn in all three cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions