Skip to content

False positive for redundant field names when using range? #2799

Closed
@avranju

Description

@avranju

For the following code:

fn main() {
    let start = 0;
    let fin = 10;
    let vals: Vec<i32> = (start..fin).map(|v| v * v).collect();
    println!("{:?}", vals);
}

Clippy warns:

warning: redundant field names in struct initialization
 --> src/main.rs:4:27
  |
4 |     let vals: Vec<i32> = (start..fin).map(|v| v * v).collect();
  |                           ^^^^^ 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.204/index.html#redundant_field_names

Is this a legitimate lint?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions