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

FP redundant_field_name: for loop #3000

Closed
matthiaskrgr opened this issue Aug 3, 2018 · 3 comments
Closed

FP redundant_field_name: for loop #3000

matthiaskrgr opened this issue Aug 3, 2018 · 3 comments

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Aug 3, 2018

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

@matthiaskrgr
Copy link
Member Author

Issue 3000 \o/ :tada:

@flip1995
Copy link
Member

flip1995 commented Aug 3, 2018

With the newest changes we got multiple problems with ranges (as macro expansions) back, that were fixed in previous PRs. (40349b2)

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.

@matthiaskrgr
Copy link
Member Author

I got clippy to build and tests to pass at least locally with #3001 :)

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