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

Conversation

Projects
None yet
6 participants
@estebank
Copy link
Contributor

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

@estebank

This comment was marked as outdated.

Copy link
Contributor Author

estebank commented Feb 8, 2019

This hasn't been tested yet

@estebank

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

zackmdavis commented Feb 8, 2019

Looks promising!

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Feb 8, 2019

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

bors added a commit that referenced this pull request Feb 8, 2019

Auto merge of #56645 - pietroalbini:fix-unused-imports, r=estebank
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>
@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 9, 2019

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

@oli-obk

This comment has been minimized.

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

This comment has been minimized.

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

Auto merge of #56645 - pietroalbini:fix-unused-imports, r=estebank
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

This comment has been minimized.

Copy link
Member

pietroalbini commented Feb 11, 2019

#56645 has been merged.

@estebank estebank force-pushed the estebank:hidden-suggestion branch from b277043 to 87dd2e1 Feb 11, 2019

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 11, 2019

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

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 11, 2019

@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

This comment has been minimized.

Copy link
Member

pietroalbini commented Feb 11, 2019

@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

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 12, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 12, 2019

📌 Commit 87dd2e1 has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019

Rollup merge of rust-lang#58296 - estebank:hidden-suggestion, r=oli-obk
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

Rollup merge of rust-lang#58296 - estebank:hidden-suggestion, r=oli-obk
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

Auto merge of #58446 - Centril:rollup, r=Centril
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

flip1995 added a commit to mikerite/rust-clippy that referenced this pull request Feb 14, 2019

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