about summary refs log tree commit diff
path: root/src/docs/string_from_utf8_as_bytes.txt
blob: 9102d73471cb27dd6e97cfc858f27e07682934f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
### What it does
Check if the string is transformed to byte array and casted back to string.

### Why is this bad?
It's unnecessary, the string can be used directly.

### Example
```
std::str::from_utf8(&"Hello World!".as_bytes()[6..11]).unwrap();
```

Use instead:
```
&"Hello World!"[6..11];
```