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:
parent
fcf22d90bb
commit
7b7ddfa55d
3 changed files with 15 additions and 4 deletions
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue