Skip to content
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

unused_variables lint fires for E0005 error #59357

Open
ehuss opened this issue Mar 22, 2019 · 0 comments
Open

unused_variables lint fires for E0005 error #59357

ehuss opened this issue Mar 22, 2019 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 22, 2019

E0005 has started issuing warnings for unused variables. It seems to just add noise, since the code is incorrect, the warning is a little misguided.

fn main() {
    let x = Some(1);
    let Some(y) = x; //~ ERROR E0005
}

displays:

error[E0005]: refutable pattern in local binding: `None` not covered
  --> E0005.rs:3:9
   |
LL |     let Some(y) = x; //~ ERROR E0005
   |         ^^^^^^^ pattern `None` not covered

warning: unused variable: `y`
  --> E0005.rs:3:14
   |
LL |     let Some(y) = x; //~ ERROR E0005
   |              ^ help: consider prefixing with an underscore: `_y`
   |
   = note: #[warn(unused_variables)] on by default

This started in #59050. I can't really tell which PR in that rollup is responsible.

This is a pretty minor issue, and perhaps issuing warnings makes more sense in other cases. Feel free to close this if it doesn't seem like an issue.

@estebank estebank added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-diagnostics Area: Messages for errors, warnings, and lints E-needs-mentor labels Mar 22, 2019
@crlf0710 crlf0710 added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants