|
1 | 1 | error: calling `as_bytes()` on a string literal
|
2 |
| - --> $DIR/string_lit_as_bytes.rs:7:14 |
| 2 | + --> $DIR/string_lit_as_bytes.rs:17:14 |
3 | 3 | |
|
4 | 4 | LL | let bs = "hello there".as_bytes();
|
5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::string-lit-as-bytes` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: calling `as_bytes()` on a string literal
|
10 |
| - --> $DIR/string_lit_as_bytes.rs:9:14 |
| 10 | + --> $DIR/string_lit_as_bytes.rs:19:14 |
11 | 11 | |
|
12 | 12 | LL | let bs = r###"raw string with 3# plus " ""###.as_bytes();
|
13 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with 3# plus " ""###`
|
14 | 14 |
|
15 | 15 | error: calling `into_bytes()` on a string literal
|
16 |
| - --> $DIR/string_lit_as_bytes.rs:11:14 |
| 16 | + --> $DIR/string_lit_as_bytes.rs:21:14 |
17 | 17 | |
|
18 | 18 | LL | let bs = "lit to string".to_string().into_bytes();
|
19 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"lit to string".to_vec()`
|
20 | 20 |
|
21 | 21 | error: calling `into_bytes()` on a string literal
|
22 |
| - --> $DIR/string_lit_as_bytes.rs:12:14 |
| 22 | + --> $DIR/string_lit_as_bytes.rs:22:14 |
23 | 23 | |
|
24 | 24 | LL | let bs = "lit to owned".to_owned().into_bytes();
|
25 | 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"lit to owned".to_vec()`
|
26 | 26 |
|
| 27 | +error: calling `as_bytes()` on a string literal |
| 28 | + --> $DIR/string_lit_as_bytes.rs:12:26 |
| 29 | + | |
| 30 | +LL | const B: &[u8] = $b.as_bytes(); |
| 31 | + | ^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"warning"` |
| 32 | +... |
| 33 | +LL | b!("warning"); |
| 34 | + | ------------- in this macro invocation |
| 35 | + | |
| 36 | + = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 37 | + |
27 | 38 | error: calling `as_bytes()` on `include_str!(..)`
|
28 |
| - --> $DIR/string_lit_as_bytes.rs:25:22 |
| 39 | + --> $DIR/string_lit_as_bytes.rs:39:22 |
29 | 40 | |
|
30 | 41 | LL | let includestr = include_str!("string_lit_as_bytes.rs").as_bytes();
|
31 | 42 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("string_lit_as_bytes.rs")`
|
32 | 43 |
|
33 | 44 | error: calling `as_bytes()` on a string literal
|
34 |
| - --> $DIR/string_lit_as_bytes.rs:27:13 |
| 45 | + --> $DIR/string_lit_as_bytes.rs:41:13 |
35 | 46 | |
|
36 | 47 | LL | let _ = "string with newline/t/n".as_bytes();
|
37 | 48 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline/t/n"`
|
38 | 49 |
|
39 |
| -error: aborting due to 6 previous errors |
| 50 | +error: aborting due to 7 previous errors |
40 | 51 |
|
0 commit comments