Fix std_instead_of_core for ListStem use#12474
Fix std_instead_of_core for ListStem use#12474MarcusGrass wants to merge 8 commits intorust-lang:masterfrom
std_instead_of_core for ListStem use#12474Conversation
|
☔ The latest upstream changes (presumably #12453) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Idea for a simpler iteration system. use std::{io::Write, fmt::Result};We get this: We can read that on their owner ID that the number with the # (I'm not sure what the number is, I've been looking at implementations of You could, for a Maybe this new approach could make the 589-lines diff simpler :) |
|
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands: The following commits are merge commits: |
fcc17bd to
d7af836
Compare
|
☔ The latest upstream changes (presumably #12921) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I did make some attempts, but it didn't turn out very well, I'll close this since I'm not working on it |
Fixes #12468.
I don't know if this fix is really worth it, it can hopefully be improved if someone knows how to implement proper look-ahead, essentially:
On
check_pathpaths come in one by one as described in #12468. The problematic paths are all contained within anItemwhich can be gotten bycheck_itemand has the kindUseKind::ListStem.Simple then, if that kind of item comes in, start collecting
Path's in it, and when the last path has passed, emit the diagnostics.But hold up! There's no way (that I know of), to know if it's the last path in the item.
We can know that all relevant paths are fully contained within the
UseKind::ListStem-span, but not when the last path is found. Since that span could contain a lot of other cruft and still be valid, like a trailing long comment.The pretty naive, and chosen, solution is to implement pretty much all checks, and if something is encountered that has a span that's outside of the currently 'in progress' use item, then close and emit the stored diagnostics.
If anyone has suggestions for better look-ahead then please feel welcome to pitch!
Also, this is pretty much a non-issue, since rustfmt will automatically split these kinds of imports, so getting a ~500 diff on a non-issue may just not be worth the hassle. Since these aren't trivially fixable it also disables the rustfix test for
std_instead_of_core. All in all, I'm not ecstatic about the change.changelog: [
std_instead_of_core]: Fixes bad suggestions for ListStem uses.