rust-lang / rust-lang/rust-clippy
`manual_let_else` recommends invalid syntax involving pair pattern binding
Open
@profetia is already working on this.
Since Jun 22, 2026.
C-bug
I-suggestion-causes-bug
L-pedantic
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
The lint warning shows the form of the original code and the recommendation:
warning: this could be rewritten as `let...else`
--> src/collision/mod.rs:694:9
|
694 | / let (object_pair, contact) = match constraint {
695 | | contact@(_, constraint::Variant::Contact (_)) => contact,
696 | | _ => continue
697 | | };
| |__________^ help: consider writing: `let (object_pair, contact) @ (_, constraint::Variant::Contact(_)) = constraint else { continue };`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
= note: requested on the command line with `-W clippy::manual-let-else`
The recommended code results in the error:
error: left-hand side of `@` must be a binding
--> src/collision/mod.rs:694:13
|
694 | let (object_pair, contact) @ (_, constraint::Variant::Contact(_)) = constraint else { continue };
| ----------------------^^^------------------------------------
| | |
| | also a pattern
| interpreted as a pattern, not a binding
|
= note: bindings are `x`, `mut x`, `ref x`, and `ref mut x`
I believe a correct refactor would be:
let (object_pair, contact@constraint::Variant::Contact(_)) = constraint else { continue };
Version
rustc 1.98.0-nightly (8b6558a02 2026-06-20)
binary: rustc
commit-hash: 8b6558a02b2774acfb25cf15e199467c37ba7490
commit-date: 2026-06-20
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.7
Additional Labels
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.