about summary refs log tree commit diff
path: root/src/docs/bind_instead_of_map.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/bind_instead_of_map.txt')
-rw-r--r--src/docs/bind_instead_of_map.txt22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/docs/bind_instead_of_map.txt b/src/docs/bind_instead_of_map.txt
deleted file mode 100644
index 148575803d3..00000000000
--- a/src/docs/bind_instead_of_map.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-### What it does
-Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))` or
-`_.or_else(|x| Err(y))`.
-
-### Why is this bad?
-Readability, this can be written more concisely as
-`_.map(|x| y)` or `_.map_err(|x| y)`.
-
-### Example
-```
-let _ = opt().and_then(|s| Some(s.len()));
-let _ = res().and_then(|s| if s.len() == 42 { Ok(10) } else { Ok(20) });
-let _ = res().or_else(|s| if s.len() == 42 { Err(10) } else { Err(20) });
-```
-
-The correct use would be:
-
-```
-let _ = opt().map(|s| s.len());
-let _ = res().map(|s| if s.len() == 42 { 10 } else { 20 });
-let _ = res().map_err(|s| if s.len() == 42 { 10 } else { 20 });
-```
\ No newline at end of file