Skip to content

#[must_use] error does not show type #42688

Closed
@jethrogb

Description

@jethrogb
Contributor

The unused_must_use lint doesn't tell you which type needs to be used. This can get confusing if multiple must_use types are involved, especially because the language used includes the word “result”:

This code:

#[must_use]
struct A;

fn a() -> Result<A, ()> {
    Ok(A)
}

fn main() {
    a().unwrap();
}

Results in:

warning: unused result which must be used
 --> <anon>:9:5
  |
9 |     a().unwrap();
  |     ^^^^^^^^^^^^^

Suggested message: unused [TYPE] which must be used

Activity

added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
on Jun 16, 2017
added a commit that references this issue on Jun 20, 2017

Rollup merge of rust-lang#42756 - sanxiyn:name-for-must-use, r=estebank

f9edbcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @sanxiyn@jethrogb

        Issue actions

          #[must_use] error does not show type · Issue #42688 · rust-lang/rust