Preserve raw strs for: format!(s) to s.to_string() lint

Ie:
|     let s = format!(r#""hello""#);
|             ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `r#""hello""#.to_string()`
This commit is contained in:
Sebastian Andersson 2020-10-09 20:23:03 +02:00
parent fcf22d90bb
commit 7b7ddfa55d
3 changed files with 15 additions and 4 deletions

View file

@ -13,7 +13,8 @@ fn main() {
"foo".to_string();
"{}".to_string();
"{} abc {}".to_string();
"foo {}\n\" bar".to_string();
r##"foo {}
" bar"##.to_string();
"foo".to_string();
format!("{:?}", "foo"); // Don't warn about `Debug`.

View file

@ -25,7 +25,13 @@ LL | / format!(
LL | | r##"foo {{}}
LL | | " bar"##
LL | | );
| |______^ help: consider using `.to_string()`: `"foo {}/n/" bar".to_string();`
| |______^
|
help: consider using `.to_string()`
|
LL | r##"foo {}
LL | " bar"##.to_string();
|
error: useless use of `format!`
--> $DIR/format.rs:21:5