mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-01-05 01:38:45 +00:00
105 lines
2 KiB
Text
105 lines
2 KiB
Text
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:4:5
|
|
|
|
|
LL | let a;
|
|
| ^^^^^^
|
|
|
|
|
= note: `-D clippy::needless-late-init` implied by `-D warnings`
|
|
help: declare `a` here
|
|
|
|
|
LL | let a = "zero";
|
|
| ~~~~~
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:7:5
|
|
|
|
|
LL | let b;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `b` here
|
|
|
|
|
LL | let b = 1;
|
|
| ~~~~~
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:8:5
|
|
|
|
|
LL | let c;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `c` here
|
|
|
|
|
LL | let c = 2;
|
|
| ~~~~~
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:12:5
|
|
|
|
|
LL | let d: usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: declare `d` here
|
|
|
|
|
LL | let d: usize = 1;
|
|
| ~~~~~~~~~~~~
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:15:5
|
|
|
|
|
LL | let mut e;
|
|
| ^^^^^^^^^^
|
|
|
|
|
help: declare `e` here
|
|
|
|
|
LL | let mut e = 1;
|
|
| ~~~~~~~~~
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:19:5
|
|
|
|
|
LL | let f;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `f` here
|
|
|
|
|
LL | let f = match 1 {
|
|
| +++++++
|
|
help: remove the assignments from the `match` arms
|
|
|
|
|
LL - 1 => f = "three",
|
|
LL + 1 => "three",
|
|
|
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:25:5
|
|
|
|
|
LL | let g: usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: declare `g` here
|
|
|
|
|
LL | let g: usize = if true {
|
|
| ++++++++++++++
|
|
help: remove the assignments from the branches
|
|
|
|
|
LL - g = 5;
|
|
LL + 5
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initalization
|
|
--> $DIR/needless_late_init_fixable.rs:32:5
|
|
|
|
|
LL | let h;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `h` here
|
|
|
|
|
LL | let h = format!("{}", e);
|
|
| ~~~~~
|
|
|
|
error: aborting due to 8 previous errors
|
|
|