Fixed short span (duplicate match arms) in match_same_arms lint#16831
Fixed short span (duplicate match arms) in match_same_arms lint#16831shashu8660 wants to merge 3 commits intorust-lang:masterfrom
Conversation
|
r? @Jarcho rustbot has assigned @Jarcho. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Lintcheck changes for 95a6ba0
This comment will be updated if you push new changes |
This comment was marked as low quality.
This comment was marked as low quality.
|
Hi @shashu8660 I think maybe you've changed a different part of the code? The issue is that this line ignores the vertical tab character: But it should include vertical tab (and maybe other Unicode whitespace in the Rust language): To test for this issue:
|
This comment was marked as low quality.
This comment was marked as low quality.
I don't know, because I can't see how the code behaves before and after this change. Please edit the PR description to show:
When we can see how the span has changed, reviewers will be able to tell you if it is useful. |
This comment was marked as low quality.
This comment was marked as low quality.
|
Sure, I can do that @shashu8660. But I still want to understand how you got from rustfoundation/interop-initiative#53 to this PR. It doesn't seem related to the original task. And the PR description says the tests pass, but CI shows they don't. So that's weird. Did you copy the PR description from somewhere else, or use Copilot or something similar to write it for you? Before anyone spends more time reviewing your PRs, we need to understand how you are creating them. |
changelog: [
match_same_arms]: highlight only duplicate match arms instead of the original armPreviously, the lint highlighted the first (original) match arm when identical arms were detected. I added UI tests to verify this behavior.
However, the lint should point to the duplicate arms rather than the original one. This change updates the span to include only duplicate arms by skipping the first element in the group, ensuring that the diagnostic points to the actual redundant code.
All tests pass, and the
.stderr/.fixedoutputs are updated accordingly.This change addresses part of the Outreachy task described in:
rustfoundation/interop-initiative#53