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

Add suggestion for duplicated import. #57973

Merged
merged 1 commit into from
Feb 5, 2019
Merged

Conversation

davidtwco
Copy link
Member

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 29, 2019
src/test/ui/issues/issue-19498.stderr Outdated Show resolved Hide resolved
src/test/ui/issues/issue-45829/import-self.stderr Outdated Show resolved Hide resolved
src/test/ui/issues/issue-45829/rename.stderr Outdated Show resolved Hide resolved
src/test/ui/issues/issue-56411.stderr Outdated Show resolved Hide resolved
src/test/ui/no-std-inject.stderr Outdated Show resolved Hide resolved
| | ^^^^^^^^^^^^^^^^^^^^^-
| |_|____________________|
| | help: remove unnecessary import
| `derive_a` reimported here
Copy link
Contributor

@estebank estebank Jan 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great behavior, although we probably should make sure we keep the #[macro_use] in the remaining extern statement... (not necessary in this PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this to prefer keeping imports with attributes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't seem to work in this case, but only address if you have time.

@michaelwoerister
Copy link
Member

r? @estebank if that's OK.

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few nitpicks inline.

src/test/ui/issues/issue-52891.stderr Show resolved Hide resolved
src/test/ui/issues/issue-45829/rename.stderr Outdated Show resolved Hide resolved
src/librustc_resolve/lib.rs Show resolved Hide resolved
src/librustc_resolve/lib.rs Outdated Show resolved Hide resolved
This commit adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 31, 2019

📌 Commit 1595163 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 31, 2019
@bors
Copy link
Contributor

bors commented Jan 31, 2019

⌛ Testing commit 1595163 with merge 2e4c395588b3a70b13989656af07b08da2be208f...

@bors

This comment has been minimized.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 1, 2019
@rust-highfive

This comment has been minimized.

@davidtwco
Copy link
Member Author

@bors retry #55861

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2019
@bors
Copy link
Contributor

bors commented Feb 4, 2019

⌛ Testing commit 1595163 with merge c6669166b92ff816adb807f6b4e87bcbfc37aa40...

@bors
Copy link
Contributor

bors commented Feb 4, 2019

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 4, 2019
@pietroalbini
Copy link
Member

Wut

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2019
@bors
Copy link
Contributor

bors commented Feb 5, 2019

⌛ Testing commit 1595163 with merge b2c6b8c...

bors added a commit that referenced this pull request Feb 5, 2019
Add suggestion for duplicated import.

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
@bors
Copy link
Contributor

bors commented Feb 5, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: estebank
Pushing b2c6b8c to master...

@bors bors merged commit 1595163 into rust-lang:master Feb 5, 2019
@davidtwco davidtwco deleted the issue-52891 branch February 5, 2019 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants