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

Misleading suggestion for unused shorthand field pattern #46866

Closed
andersk opened this issue Dec 20, 2017 · 1 comment
Closed

Misleading suggestion for unused shorthand field pattern #46866

andersk opened this issue Dec 20, 2017 · 1 comment

Comments

@andersk
Copy link
Contributor

andersk commented Dec 20, 2017

use std::ops::Range;
fn range_end(Range { start, end }: Range<u32>) -> u32 {
    end
}

gives

warning: unused variable: `start`
 --> test.rs:2:22
  |
2 | fn range_end(Range { start, end }: Range<u32>) -> u32 {
  |                      ^^^^^
  |
  = note: #[warn(unused_variables)] on by default
  = note: to avoid this warning, consider using `_start` instead

You can’t just change start to _start here, of course—we should suggest start: _ instead.

@Mark-Simulacrum
Copy link
Member

#47390 has more discussion, so I'll close in favor of that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants