summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/manual_strip.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/manual_strip.txt')
-rw-r--r--src/tools/clippy/src/docs/manual_strip.txt24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/tools/clippy/src/docs/manual_strip.txt b/src/tools/clippy/src/docs/manual_strip.txt
deleted file mode 100644
index f32d8e7a0..000000000
--- a/src/tools/clippy/src/docs/manual_strip.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-### What it does
-Suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using
-the pattern's length.
-
-### Why is this bad?
-Using `str:strip_{prefix,suffix}` is safer and may have better performance as there is no
-slicing which may panic and the compiler does not need to insert this panic code. It is
-also sometimes more readable as it removes the need for duplicating or storing the pattern
-used by `str::{starts,ends}_with` and in the slicing.
-
-### Example
-```
-let s = "hello, world!";
-if s.starts_with("hello, ") {
- assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!");
-}
-```
-Use instead:
-```
-let s = "hello, world!";
-if let Some(end) = s.strip_prefix("hello, ") {
- assert_eq!(end.to_uppercase(), "WORLD!");
-}
-``` \ No newline at end of file