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

Hidden suggestion support #58296

Merged
merged 5 commits into from
Feb 14, 2019
Merged

Hidden suggestion support #58296

merged 5 commits into from
Feb 14, 2019

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Feb 8, 2019

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 8, 2019
@estebank

This comment has been minimized.

@estebank
Copy link
Contributor Author

estebank commented Feb 8, 2019

@zackmdavis This PR is to allow @pietroalbini to add a suggestion to remove a few items out of an use statement without cluttering the output with secondary spans that don't add much:

LL | use foo::{bar, qux};
   |              --^^^ unused import
   |              |
   |              help: remove the import

becomes

LL | use foo::{bar, qux};
   |                ^^^ unused import
   = help: remove the import

@zackmdavis
Copy link
Member

Looks promising!

@pietroalbini
Copy link
Member

Assign this to another person, I'm not expert enough of this part of the codebase to review this PR.

@estebank
Copy link
Contributor Author

estebank commented Feb 9, 2019

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned pietroalbini Feb 9, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Feb 9, 2019

The impl Lgtm but I'm not too happy about merging it without using it

@estebank
Copy link
Contributor Author

estebank commented Feb 9, 2019

@oli-obk It makes sense to wait for #56645 to be merged and then I can rebase and add uses.

bors added a commit that referenced this pull request Feb 11, 2019
Initial implementation of rustfixable unused_imports lint

This PR adds the initial implementation of rustfixable `unused_imports` lint. The implementation works, but rustfix is not able to apply all the suggestions until #53934 is fixed. It also needs #58296 to hide the suggested note since it's really useless.

cc #47888

<details><summary><code>cargo fix</code> in action on the <code>unused_imports</code> lint</summary>

![screenshot from 2018-12-09 15-49-01](https://user-images.githubusercontent.com/2299951/49698874-3a026080-fbca-11e8-9bf1-24060b6c59c8.png)

</details>
@pietroalbini
Copy link
Member

#56645 has been merged.

@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 11, 2019
@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 11, 2019
@estebank
Copy link
Contributor Author

We'll need to update these tests to run rustfix once the rustfix in master can handle these cases, but checking the json output shows that these are correctly exposed. We don't expose the type of suggestion, so tools will not be able to differentiate between the different styles, but I think that is something we can defer on.

@estebank
Copy link
Contributor Author

@oli-obk added one use of these methods, leaving the other methods in because otherwise it feels incomplete.

@pietroalbini please verify that the new output is what you had in mind. VSCode will still provide the same messages as before.

@pietroalbini
Copy link
Member

@pietroalbini please verify that the new output is what you had in mind. VSCode will still provide the same messages as before.

Yep, thanks!

@oli-obk
Copy link
Contributor

oli-obk commented Feb 12, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Feb 12, 2019

📌 Commit 87dd2e1 has been approved by oli-obk

@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 12, 2019
Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019
Hidden suggestion support

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis
Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019
Hidden suggestion support

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis
bors added a commit that referenced this pull request Feb 14, 2019
Rollup of 8 pull requests

Successful merges:

 - #57451 (suggestion-diagnostics: as_ref improve snippet)
 - #57856 (Convert old first edition links to current edition one)
 - #57992 (Update the future/task API)
 - #58258 (Reduce the size of `hir::Expr`.)
 - #58267 (Tweak "incompatible match arms" error)
 - #58296 (Hidden suggestion support)
 - #58301 (Enable comparing fat pointers)
 - #58308 (Extract block to insert an intrinsic into its own function)

Failed merges:

r? @ghost
@bors bors merged commit 87dd2e1 into rust-lang:master Feb 14, 2019
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