You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #3879 - phansch:rustfix_string_lit_as_bytes, r=flip1995
Run rustfix for string_lit_as_bytes tests
This moves the `string_lit_as_bytes` tests into a new file and enables
rustfix tests for them.
cc #3603, #2038
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"`
6
+
|
7
+
= note: `-D clippy::string-lit-as-bytes` implied by `-D warnings`
8
+
9
+
error: calling `as_bytes()` on a string literal
10
+
--> $DIR/string_lit_as_bytes.rs:9:14
11
+
|
12
+
LL | let bs = r###"raw string with three ### in it and some " ""###.as_bytes();
13
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with three ### in it and some " ""###`
14
+
15
+
error: calling `as_bytes()` on `include_str!(..)`
16
+
--> $DIR/string_lit_as_bytes.rs:16:22
17
+
|
18
+
LL | let includestr = include_str!("entry.rs").as_bytes();
19
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("entry.rs")`
Copy file name to clipboardExpand all lines: tests/ui/strings.stderr
+1-21
Original file line number
Diff line number
Diff line change
@@ -52,25 +52,5 @@ error: you added something to a string. Consider using `String::push_str()` inst
52
52
LL | let z = y + "...";
53
53
| ^^^^^^^^^
54
54
55
-
error: calling `as_bytes()` on a string literal
56
-
--> $DIR/strings.rs:48:14
57
-
|
58
-
LL | let bs = "hello there".as_bytes();
59
-
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"`
60
-
|
61
-
= note: `-D clippy::string-lit-as-bytes` implied by `-D warnings`
62
-
63
-
error: calling `as_bytes()` on a string literal
64
-
--> $DIR/strings.rs:50:14
65
-
|
66
-
LL | let bs = r###"raw string with three ### in it and some " ""###.as_bytes();
67
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with three ### in it and some " ""###`
68
-
69
-
error: calling `as_bytes()` on `include_str!(..)`
70
-
--> $DIR/strings.rs:57:22
71
-
|
72
-
LL | let includestr = include_str!("entry.rs").as_bytes();
73
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("entry.rs")`
0 commit comments