Use a type implementing Drop
This commit is contained in:
parent
7feeaf0d27
commit
fea2cdb0a4
2 changed files with 18 additions and 2 deletions
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x; //~ ERROR: variable does not need to be mutable
|
let mut x; //~ ERROR: variable does not need to be mutable
|
||||||
x = 0;
|
x = String::new();
|
||||||
dbg!(0);
|
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…
Reference in a new issue