mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
6444621c10
manual_let_else: do not suggest semantically different replacements The problem is that this lint does not consider the possibility that the divergent branch can come first and that the patterns may overlap. This led to incorrect suggestions, previously registered as correct in the tests themselves: ```rust let v = match build_enum() { _ => continue, Variant::Bar(v) | Variant::Baz(v) => v, }; ``` had a `let Variant::Bar(v) | Variant::Baz(v) = v else { continue; }` suggestion, which is obviously wrong as the original code `continue`s in any case. Issue #10241 gives another example. The code now checks that the divergent branch comes second. It could be extended later (I've added a TODO) to check for non-overlapping patterns. Fixes #10241. changelog: [`manual_let_else`] do not suggest non equivalent replacements in `match` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |