Skip to content

#[must_use] error does not show type #42688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jethrogb opened this issue Jun 15, 2017 · 0 comments
Closed

#[must_use] error does not show type #42688

jethrogb opened this issue Jun 15, 2017 · 0 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@jethrogb
Copy link
Contributor

jethrogb commented Jun 15, 2017

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

@sanxiyn sanxiyn added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Jun 16, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

2 participants