Rust-clippy: FP redundant_field_name: for loop

Created on 3 Aug 2018  路  3Comments  路  Source: rust-lang/rust-clippy

I seen this in cargo a lot:
code like this
rust 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

Most helpful comment

Issue 3000 \o/ :tada:

All 3 comments

Issue 3000 \o/ :tada:

With the newest changes we got multiple problems with ranges (as macro expansions) back, that were fixed in previous PRs. (https://github.com/rust-lang-nursery/rust-clippy/commit/40349b23ea1730f9a5ef4056edf4854908073a48)

For this issue see especially #2507

We also got some other problems, where we want to look at ranges, but do not get to it, because we bail out earlier, because of a if in_macro(span) { return } check. I plan to open an issue summarizing these bugs, once Clippy is building (and tests are fixed) again.

I got clippy to build and tests to pass at least locally with https://github.com/rust-lang-nursery/rust-clippy/pull/3001 :)

Was this page helpful?
0 / 5 - 0 ratings