summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/bytes_count_to_len.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/bytes_count_to_len.txt')
-rw-r--r--src/tools/clippy/src/docs/bytes_count_to_len.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/bytes_count_to_len.txt b/src/tools/clippy/src/docs/bytes_count_to_len.txt
new file mode 100644
index 000000000..ca7bf9a38
--- /dev/null
+++ b/src/tools/clippy/src/docs/bytes_count_to_len.txt
@@ -0,0 +1,18 @@
+### What it does
+It checks for `str::bytes().count()` and suggests replacing it with
+`str::len()`.
+
+### Why is this bad?
+`str::bytes().count()` is longer and may not be as performant as using
+`str::len()`.
+
+### Example
+```
+"hello".bytes().count();
+String::from("hello").bytes().count();
+```
+Use instead:
+```
+"hello".len();
+String::from("hello").len();
+``` \ No newline at end of file