]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/match_single_binding.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / match_single_binding.txt
1 ### What it does
2 Checks for useless match that binds to only one value.
3
4 ### Why is this bad?
5 Readability and needless complexity.
6
7 ### Known problems
8  Suggested replacements may be incorrect when `match`
9 is actually binding temporary value, bringing a 'dropped while borrowed' error.
10
11 ### Example
12 ```
13 match (a, b) {
14     (c, d) => {
15         // useless match
16     }
17 }
18 ```
19
20 Use instead:
21 ```
22 let (c, d) = (a, b);
23 ```