Use a type implementing Drop
This commit is contained in:
parent
7feeaf0d27
commit
fea2cdb0a4
@ -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);
|
||||
}
|
||||
|
16
src/test/ui/nll/issue-61424.stderr
Normal file
16
src/test/ui/nll/issue-61424.stderr
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user