-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add a machine-applicable suggestion to "unreachable pattern" #128991
Conversation
This comment has been minimized.
This comment has been minimized.
IMO more often than not this lint suggests that there's some other kind of bug and removing the unreachable pattern isn't what the user actually wants, so I'm not sure this should be machine applicable and autofixed by rustfix. E.g. when using a constant as a pattern but that constant is suddenly no longer in scope (can happen after a refactor): mod ext {
pub const BAR: i32 = 1;
}
match 1 {
BAR => {},
_ => {}
} The last arm has an unreachable arm warning, but removing the last arm here is not what the user wants. It's more an issue with the binding pattern that is causing this arm to be unreachable |
r? compiler-errors |
@rustbot author |
c507758
to
10ae774
Compare
That's fair. I wonder if I should restrict it to the "empty pattern" cases, so it can function as a migration lint but not more. I doubt there'd be false positives there. @rustbot ready |
I changed the suggestion to only apply to empty pattern. That way the lint makes the transition to |
b006036
to
a0ffb44
Compare
☔ The latest upstream changes (presumably #129359) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me when rebased @rustbot author |
a0ffb44
to
7a3d26c
Compare
I'll wait for #129103 to get in first |
This comment was marked as resolved.
This comment was marked as resolved.
7a3d26c
to
1f69638
Compare
☀️ Test successful - checks-actions |
Finished benchmarking commit (f9567d0): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary 3.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 758.501s -> 757.31s (-0.16%) |
No description provided.