rust/tests
bors 6444621c10 Auto merge of #10336 - samueltardieu:issue-10241, r=llogiq
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`
2023-02-16 20:30:42 +00:00
..
test_utils Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
ui Auto merge of #10336 - samueltardieu:issue-10241, r=llogiq 2023-02-16 20:30:42 +00:00
ui-cargo Merge commit 'f4850f7292' into clippyup 2022-11-21 20:51:52 +01:00
ui-internal Merge remote-tracking branch 'upstream/master' into rustup 2023-02-10 11:33:45 +01:00
ui-toml Merge commit '7f27e2e74e' into clippyup 2023-01-12 19:48:13 +01:00
workspace_test
check-fmt.rs Merge commit 'f51aade56f' into clippyup 2022-08-31 09:24:45 -04:00
clippy.toml
compile-test.rs Merge commit '4f142aa105' into clippyup 2022-10-23 15:18:45 +02:00
dogfood.rs Merge commit '4f142aa105' into clippyup 2022-10-23 15:18:45 +02:00
integration.rs Merge commit '7f27e2e74e' into clippyup 2023-01-12 19:48:13 +01:00
lint_message_convention.rs Merge commit 'ac0e10aa68' into clippyup 2022-10-06 09:44:38 +02:00
missing-test-files.rs Merge commit 'ac0e10aa68' into clippyup 2022-10-06 09:44:38 +02:00
versioncheck.rs Merge commit '4bdfb0741d' into clippyup 2022-12-17 14:12:54 +01:00
workspace.rs Merge commit 'f51aade56f' into clippyup 2022-08-31 09:24:45 -04:00