]> git.lizzy.rs Git - rust.git/blob - src/docs/string_from_utf8_as_bytes.txt
new uninlined_format_args lint to inline explicit arguments
[rust.git] / src / docs / string_from_utf8_as_bytes.txt
1 ### What it does
2 Check if the string is transformed to byte array and casted back to string.
3
4 ### Why is this bad?
5 It's unnecessary, the string can be used directly.
6
7 ### Example
8 ```
9 std::str::from_utf8(&"Hello World!".as_bytes()[6..11]).unwrap();
10 ```
11
12 Use instead:
13 ```
14 &"Hello World!"[6..11];
15 ```