diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/match_single_binding.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/match_single_binding.txt b/src/tools/clippy/src/docs/match_single_binding.txt new file mode 100644 index 000000000..67ded0bbd --- /dev/null +++ b/src/tools/clippy/src/docs/match_single_binding.txt @@ -0,0 +1,23 @@ +### 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); +```
\ No newline at end of file |