Skip to content

unused must_use warning should have an auto-fix to just remove the useless attribute #145257

@Lokathor

Description

@Lokathor

So I've got a project with 140 #[must_use] attributes on methods of trait impls. Rust tells me they have no effect when applied to a trait method:

warning: `#[must_use]` has no effect when applied to a provided trait method
    --> src/x86_x64/avx.rs:2250:3
     |
2250 |   #[must_use]
     |   ^^^^^^^^^^^

so far so good, except cargo fix can't just remove all the useless must_use for me, which it should be able to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.D-lack-of-suggestionDiagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.L-unused_attributesLint: unused_attributesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions