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

Only ensure solutions are in the same file in cargo fix #6402

Merged
merged 2 commits into from Dec 10, 2018

Conversation

Projects
None yet
4 participants
@pietroalbini
Copy link
Member

pietroalbini commented Dec 8, 2018

This PR changes cargo fix to avoid rejecting machine-applicable lints with multiple suggestions. Instead, now it only checks the solutions are in the same file.

I don't know how to write a test for this, since no lint in rustc relies on the new behavior and the existing cargo fix tests just invoke lints in rustc. Any idea on that would be appreciated.

r? @alexcrichton
cc @killercup
fixes #6401

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Dec 8, 2018

Trying this with my local rustc branch doesn't work yet, let me fix it.

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Dec 8, 2018

Nevermind, ran the wrong cargo binary... This patch works fine.

it works!

@pietroalbini

This comment was marked as resolved.

Copy link
Member

pietroalbini commented Dec 8, 2018

I'd like to also include a bump of rustfix in this PR, once rust-lang-nursery/rustfix#155 is merged.

@killercup
Copy link
Member

killercup left a comment

Looks good. Ideally, we'd add a test here, too, but that is probably blocked on rust-lang/rust#56645

Show resolved Hide resolved src/cargo/ops/fix.rs Outdated

@pietroalbini pietroalbini changed the title Only ensure solutions are in the same file in cargo fix [WIP] Only ensure solutions are in the same file in cargo fix Dec 9, 2018

fix: refactor same-file check
Co-Authored-By: Pascal Hertleif <killercup@gmail.com>

@pietroalbini pietroalbini force-pushed the pietroalbini:fix-cargofix branch from bb18b2d to a9f64b2 Dec 9, 2018

@pietroalbini pietroalbini changed the title [WIP] Only ensure solutions are in the same file in cargo fix Only ensure solutions are in the same file in cargo fix Dec 9, 2018

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Dec 9, 2018

Ok, removed the bump to rustfix 0.4.3. This is ready to be reviewed, even though it's not enough on its own for rust-lang/rust#56645 (needs a fix for rust-lang/rust#53934 before I can fix all the unused_imports).

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 10, 2018

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 10, 2018

📌 Commit a9f64b2 has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 10, 2018

⌛️ Testing commit a9f64b2 with merge e074068...

bors added a commit that referenced this pull request Dec 10, 2018

Auto merge of #6402 - pietroalbini:fix-cargofix, r=alexcrichton
Only ensure solutions are in the same file in cargo fix

This PR changes `cargo fix` to avoid rejecting machine-applicable lints with multiple suggestions. Instead, now it only checks the solutions are in the same file.

I don't know how to write a test for this, since no lint in rustc relies on the new behavior and the existing `cargo fix` tests just invoke lints in rustc. Any idea on that would be appreciated.

r? @alexcrichton
cc @killercup
fixes #6401
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 10, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing e074068 to master...

@bors bors merged commit a9f64b2 into rust-lang:master Dec 10, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@pietroalbini pietroalbini deleted the pietroalbini:fix-cargofix branch Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment