]> git.lizzy.rs Git - rust.git/blob - src/docs/bytes_nth.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / bytes_nth.txt
1 ### What it does
2 Checks for the use of `.bytes().nth()`.
3
4 ### Why is this bad?
5 `.as_bytes().get()` is more efficient and more
6 readable.
7
8 ### Example
9 ```
10 "Hello".bytes().nth(3);
11 ```
12
13 Use instead:
14 ```
15 "Hello".as_bytes().get(3);
16 ```