-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Group unused import warnings per import list #37456
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
1fcc56c
to
35540ac
Compare
Might want to check https://s3.amazonaws.com/archive.travis-ci.org/jobs/171581156/log.txt for the test failures |
ffbeb3c
to
c336f15
Compare
|
||
|
||
struct UnusedImportCheckVisitor<'a, 'b: 'a> { | ||
resolver: &'a mut Resolver<'b>, | ||
/// All the (so far) unused imports, grouped path list | ||
unused_imports: HashMap<ast::NodeId, HashMap<ast::NodeId, Span>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use NodeMap<NodeMap<Span>>
here (from rustc::util::nodemap
).
c96b6a2
to
8c745d6
Compare
@bors r+ |
📌 Commit 8c745d6 has been approved by |
☔ The latest upstream changes (presumably #37191) made this pull request unmergeable. Please resolve the merge conflicts. |
8c745d6
to
2a82785
Compare
@jonathandturner rebased to fix merge conflict and while I was at it, squashed to clean commit history. |
☔ The latest upstream changes (presumably #37497) made this pull request unmergeable. Please resolve the merge conflicts. |
2a82785
to
0c47923
Compare
☔ The latest upstream changes (presumably #37167) made this pull request unmergeable. Please resolve the merge conflicts. |
Given a file ```rust use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; fn main() {} ``` Show a single warning, instead of three for each unused import: ```nocode warning: unused imports, #[warn(unused_imports)] on by default --> foo.rs:1:24 | 1 | use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; | ^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ``` Include support for lints pointing at `MultilineSpan`s, instead of just `Span`s.
0c47923
to
a820d99
Compare
@bors: r=jonathandturner (assuming nothing changed, but @jonathandturner feel free to correct me!) btw I'm pretty stoked about this change! |
📌 Commit a820d99 has been approved by |
Sweet fix for an ancient bug! |
…turner Group unused import warnings per import list Given a file ``` rust use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; fn main() {} ``` Show a single warning, instead of three for each unused import: ``` nocode warning: unused imports, #[warn(unused_imports)] on by default --> file2.rs:1:24 | 1 | use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; | ^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ``` Include support for lints pointing at `MultilineSpan`s, instead of just `Span`s. Fixes #16132.
\o/ you're awesome, @estebank |
Given a file
Show a single warning, instead of three for each unused import:
Include support for lints pointing at
MultilineSpan
s, instead of justSpan
s.Fixes #16132.