|
1 |
| -error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking |
2 |
| ---> $DIR/slice_as_bytes.rs:29:17 |
3 |
| -| |
| 1 | +error: calling `as_bytes` after slicing a string |
| 2 | + --> tests/ui/slice_as_bytes.rs:28:17 |
| 3 | + | |
4 | 4 | LL | let bytes = s[1..5].as_bytes();
|
5 |
| -| ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]` |
6 |
| -| |
7 |
| -= note: `-D clippy::slice-as-bytes` implied by `-D warnings` |
| 5 | + | ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]` |
| 6 | + | |
| 7 | + = note: `-D clippy::slice-as-bytes` implied by `-D warnings` |
| 8 | + = help: to override `-D warnings` add `#[allow(clippy::slice_as_bytes)]` |
8 | 9 |
|
9 |
| -error: slicing a String before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking |
10 |
| ---> $DIR/slice_as_bytes.rs:30:17 |
11 |
| -| |
| 10 | +error: calling `as_bytes` after slicing a string |
| 11 | + --> tests/ui/slice_as_bytes.rs:29:17 |
| 12 | + | |
12 | 13 | LL | let bytes = string[1..].as_bytes();
|
13 |
| -| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]` |
| 14 | + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]` |
14 | 15 |
|
15 |
| -error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking |
16 |
| ---> $DIR/slice_as_bytes.rs:31:17 |
17 |
| -| |
| 16 | +error: calling `as_bytes` after slicing a string |
| 17 | + --> tests/ui/slice_as_bytes.rs:30:17 |
| 18 | + | |
18 | 19 | LL | let bytes = "consectetur adipiscing"[..=5].as_bytes();
|
19 |
| -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]` |
| 20 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]` |
20 | 21 |
|
21 | 22 | error: aborting due to 3 previous errors
|
| 23 | + |
0 commit comments