about summary refs log tree commit diff
path: root/src/docs/index_refutable_slice.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/index_refutable_slice.txt')
-rw-r--r--src/docs/index_refutable_slice.txt29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/docs/index_refutable_slice.txt b/src/docs/index_refutable_slice.txt
deleted file mode 100644
index 8a7d52761af..00000000000
--- a/src/docs/index_refutable_slice.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-### What it does
-The lint checks for slice bindings in patterns that are only used to
-access individual slice values.
-
-### Why is this bad?
-Accessing slice values using indices can lead to panics. Using refutable
-patterns can avoid these. Binding to individual values also improves the
-readability as they can be named.
-
-### Limitations
-This lint currently only checks for immutable access inside `if let`
-patterns.
-
-### Example
-```
-let slice: Option<&[u32]> = Some(&[1, 2, 3]);
-
-if let Some(slice) = slice {
-    println!("{}", slice[0]);
-}
-```
-Use instead:
-```
-let slice: Option<&[u32]> = Some(&[1, 2, 3]);
-
-if let Some(&[first, ..]) = slice {
-    println!("{}", first);
-}
-```
\ No newline at end of file