summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/bytes_count_to_len.txt
blob: ca7bf9a38da8e25262eb0b4f761bcb622a3db13d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();
```