RS.CLIPPY.MATCH_SINGLE_BINDING
A match with a single binding instead of using `let` statement
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: match_single_binding. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for useless match that binds to only one value.
Why is this bad?
Readability and needless complexity.
Known problems
Suggested replacements may be incorrect when match
is actually binding temporary value, bringing a 'dropped while borrowed' error.
Example
match (a, b) {
(c, d) => {
// useless match
}
}
Use instead:
let (c, d) = (a, b);