Skip to content

#[must_use] silently does nothing on type aliases #26281

Closed
@tamird

Description

@tamird

There are at least two problems with #[must_use]:

  • it doesn't work on type aliases at all.
  • for methods that return a type containing a #[must_use] type, no warning is issued if the #[must_use] value is immediately discarded by destructuring assignment at the caller.

http://is.gd/TEG45t


Edit: the consensus is that #[must_use] should not be usable on type aliases, but it should not just silently fail. The behaviour with destructing assignment is intentional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions