Skip to content

FP redundant_field_name: for loop #3000

@matthiaskrgr

Description

@matthiaskrgr

I seen this in cargo a lot:
code like this

                for line in String::from_utf8_lossy(&dst[start..]).lines() {

triggers

warning: redundant field names in struct initialization
   --> src/cargo/util/process_builder.rs:240:58
    |
240 |                 for line in String::from_utf8_lossy(&dst[start..]).lines() {
    |                                                          ^^^^^ 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.212/index.html#redundant_field_names

which looks like complete bogus to me.
https://github.com/rust-lang/cargo/blob/master/src/cargo/util/process_builder.rs#L240

EDIT: 0.0.212

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions