Use a type implementing Drop

This commit is contained in:
Chris Gregory 2019-06-02 19:11:15 -07:00
parent 7feeaf0d27
commit fea2cdb0a4
2 changed files with 18 additions and 2 deletions

View file

@ -2,6 +2,6 @@
fn main() {
let mut x; //~ ERROR: variable does not need to be mutable
x = 0;
dbg!(0);
x = String::new();
dbg!(x);
}

View file

@ -0,0 +1,16 @@
error: variable does not need to be mutable
--> $DIR/issue-61424.rs:4:9
|
LL | let mut x;
| ----^
| |
| help: remove this `mut`
|
note: lint level defined here
--> $DIR/issue-61424.rs:1:9
|
LL | #![deny(unused_mut)]
| ^^^^^^^^^^
error: aborting due to previous error