Skip to content

redundant_field_names with ranges #2491

New issue

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

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

Already on GitHub? # to your account

Closed
ordovicia opened this issue Feb 27, 2018 · 1 comment
Closed

redundant_field_names with ranges #2491

ordovicia opened this issue Feb 27, 2018 · 1 comment

Comments

@ordovicia
Copy link
Contributor

Playground

Clippy suggests replacing variable start with start and end with end used in range syntax.
I guess that is because the syntax is syntactic sugar and structs resulting from desugaring have fields with these names.
IMHO we should make an exception to treat these range syntax.

warning: redundant field names in struct initialization
 --> src/main.rs:3:13
  |
3 |     let _ = start..;
  |             ^^^^^ help: replace it with: `start`
  |
  = note: #[warn(redundant_field_names)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names

warning: redundant field names in struct initialization
 --> src/main.rs:6:15
  |
6 |     let _ = ..end;
  |               ^^^ help: replace it with: `end`
  |
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names

warning: redundant field names in struct initialization
 --> src/main.rs:8:13
  |
8 |     let _ = start..end;
  |             ^^^^^ help: replace it with: `start`
  |
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names

warning: redundant field names in struct initialization
 --> src/main.rs:8:20
  |
8 |     let _ = start..end;
  |                    ^^^ help: replace it with: `end`
  |
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names
@imp
Copy link
Contributor

imp commented Feb 27, 2018

Hit this as well this morning, when my CI started to fail after update to 0.0.187.

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

No branches or pull requests

2 participants