mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Add regression test for string_lit_as_bytes issue
This commit is contained in:
parent
6c008d7e91
commit
ae0ce2255a
3 changed files with 6 additions and 2 deletions
|
@ -14,6 +14,8 @@ fn str_lit_as_bytes() {
|
||||||
|
|
||||||
let strify = stringify!(foobar).as_bytes();
|
let strify = stringify!(foobar).as_bytes();
|
||||||
|
|
||||||
|
let current_version = env!("CARGO_PKG_VERSION").as_bytes();
|
||||||
|
|
||||||
let includestr = include_bytes!("entry_unfixable.rs");
|
let includestr = include_bytes!("entry_unfixable.rs");
|
||||||
|
|
||||||
let _ = b"string with newline\t\n";
|
let _ = b"string with newline\t\n";
|
||||||
|
|
|
@ -14,6 +14,8 @@ fn str_lit_as_bytes() {
|
||||||
|
|
||||||
let strify = stringify!(foobar).as_bytes();
|
let strify = stringify!(foobar).as_bytes();
|
||||||
|
|
||||||
|
let current_version = env!("CARGO_PKG_VERSION").as_bytes();
|
||||||
|
|
||||||
let includestr = include_str!("entry_unfixable.rs").as_bytes();
|
let includestr = include_str!("entry_unfixable.rs").as_bytes();
|
||||||
|
|
||||||
let _ = "string with newline\t\n".as_bytes();
|
let _ = "string with newline\t\n".as_bytes();
|
||||||
|
|
|
@ -13,13 +13,13 @@ LL | let bs = r###"raw string with 3# plus " ""###.as_bytes();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with 3# plus " ""###`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with 3# plus " ""###`
|
||||||
|
|
||||||
error: calling `as_bytes()` on `include_str!(..)`
|
error: calling `as_bytes()` on `include_str!(..)`
|
||||||
--> $DIR/string_lit_as_bytes.rs:17:22
|
--> $DIR/string_lit_as_bytes.rs:19:22
|
||||||
|
|
|
|
||||||
LL | let includestr = include_str!("entry_unfixable.rs").as_bytes();
|
LL | let includestr = include_str!("entry_unfixable.rs").as_bytes();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("entry_unfixable.rs")`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("entry_unfixable.rs")`
|
||||||
|
|
||||||
error: calling `as_bytes()` on a string literal
|
error: calling `as_bytes()` on a string literal
|
||||||
--> $DIR/string_lit_as_bytes.rs:19:13
|
--> $DIR/string_lit_as_bytes.rs:21:13
|
||||||
|
|
|
|
||||||
LL | let _ = "string with newline/t/n".as_bytes();
|
LL | let _ = "string with newline/t/n".as_bytes();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline/t/n"`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline/t/n"`
|
||||||
|
|
Loading…
Reference in a new issue