mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-25 04:23:22 +00:00
186 lines
3.5 KiB
Text
186 lines
3.5 KiB
Text
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:5:5
|
|
|
|
|
LL | let a;
|
|
| ^^^^^^
|
|
|
|
|
= note: `-D clippy::needless-late-init` implied by `-D warnings`
|
|
help: declare `a` here
|
|
|
|
|
LL | let a = match n {
|
|
| +++++++
|
|
help: remove the assignments from the `match` arms
|
|
|
|
|
LL ~ 1 => "one",
|
|
LL | _ => {
|
|
LL ~ "two"
|
|
|
|
|
help: add a semicolon after the `match` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:14:5
|
|
|
|
|
LL | let b;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `b` here
|
|
|
|
|
LL | let b = if n == 3 {
|
|
| +++++++
|
|
help: remove the assignments from the branches
|
|
|
|
|
LL ~ "four"
|
|
LL | } else {
|
|
LL ~ "five"
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:21:5
|
|
|
|
|
LL | let c;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `c` here
|
|
|
|
|
LL | let c = if let Some(n) = Some(5) {
|
|
| +++++++
|
|
help: remove the assignments from the branches
|
|
|
|
|
LL ~ n
|
|
LL | } else {
|
|
LL ~ -50
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:28:5
|
|
|
|
|
LL | let d;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `d` here
|
|
|
|
|
LL | let d = if true {
|
|
| +++++++
|
|
help: remove the assignments from the branches
|
|
|
|
|
LL ~ temp
|
|
LL | } else {
|
|
LL ~ 15
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:36:5
|
|
|
|
|
LL | let e;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `e` here
|
|
|
|
|
LL | let e = if true {
|
|
| +++++++
|
|
help: remove the assignments from the branches
|
|
|
|
|
LL ~ format!("{} {}", a, b)
|
|
LL | } else {
|
|
LL ~ format!("{}", c)
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:43: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 initialization
|
|
--> $DIR/needless_late_init.rs:49: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 initialization
|
|
--> $DIR/needless_late_init.rs:64:5
|
|
|
|
|
LL | let a;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `a` here
|
|
|
|
|
LL | let a = match n {
|
|
| +++++++
|
|
help: remove the assignments from the `match` arms
|
|
|
|
|
LL ~ 1 => f().await,
|
|
LL | _ => {
|
|
LL ~ "two"
|
|
|
|
|
help: add a semicolon after the `match` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: unneeded late initialization
|
|
--> $DIR/needless_late_init.rs:81:5
|
|
|
|
|
LL | let a;
|
|
| ^^^^^^
|
|
|
|
|
help: declare `a` here
|
|
|
|
|
LL | let a = match n {
|
|
| +++++++
|
|
help: remove the assignments from the `match` arms
|
|
|
|
|
LL ~ 1 => f(),
|
|
LL | _ => {
|
|
LL ~ "two"
|
|
|
|
|
help: add a semicolon after the `match` expression
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: aborting due to 9 previous errors
|
|
|