Add test for removing &mut for &mut format!().
This commit is contained in:
parent
b4524f8bf0
commit
ecebb669d5
2 changed files with 25 additions and 1 deletions
|
@ -3,4 +3,8 @@ fn main() {
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
let b: String = &format!("b");
|
let b: String = &format!("b");
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
|
let c: String = &mut format!("c");
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
let d: String = &mut (format!("d"));
|
||||||
|
//~^ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,26 @@ LL | let b: String = &format!("b");
|
||||||
| | help: consider removing the borrow: `format!("b")`
|
| | help: consider removing the borrow: `format!("b")`
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/format-borrow.rs:6:21
|
||||||
|
|
|
||||||
|
LL | let c: String = &mut format!("c");
|
||||||
|
| ------ ^^^^^^^^^^^^^^^^^
|
||||||
|
| | |
|
||||||
|
| | expected struct `String`, found `&mut String`
|
||||||
|
| | help: consider removing the borrow: `format!("c")`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/format-borrow.rs:8:21
|
||||||
|
|
|
||||||
|
LL | let d: String = &mut (format!("d"));
|
||||||
|
| ------ ^^^^^^^^^^^^^^^^^^^
|
||||||
|
| | |
|
||||||
|
| | expected struct `String`, found `&mut String`
|
||||||
|
| | help: consider removing the borrow: `format!("d")`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
For more information about this error, try `rustc --explain E0308`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue