diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/manual_map.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/manual_map.txt b/src/tools/clippy/src/docs/manual_map.txt new file mode 100644 index 000000000..7f68ccd10 --- /dev/null +++ b/src/tools/clippy/src/docs/manual_map.txt @@ -0,0 +1,17 @@ +### What it does +Checks for usages of `match` which could be implemented using `map` + +### Why is this bad? +Using the `map` method is clearer and more concise. + +### Example +``` +match Some(0) { + Some(x) => Some(x + 1), + None => None, +}; +``` +Use instead: +``` +Some(0).map(|x| x + 1); +```
\ No newline at end of file |