error: unneeded late initialization --> tests/ui/needless_late_init.rs:27:5 | LL | let a; | ^^^^^^ created here LL | a = "zero"; | ^^^^^^^^^^ initialised here | = note: `-D clippy::needless-late-init` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_late_init)]` help: move the declaration `a` here | LL ~ LL ~ let a = "zero"; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:30:5 | LL | let b; | ^^^^^^ created here LL | let c; LL | b = 1; | ^^^^^ initialised here | help: move the declaration `b` here | LL ~ LL | let c; LL ~ let b = 1; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:31:5 | LL | let c; | ^^^^^^ created here LL | b = 1; LL | c = 2; | ^^^^^ initialised here | help: move the declaration `c` here | LL ~ LL | b = 1; LL ~ let c = 2; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:35:5 | LL | let d: usize; | ^^^^^^^^^^^^^ created here LL | d = 1; | ^^^^^ initialised here | help: move the declaration `d` here | LL ~ LL ~ let d: usize = 1; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:38:5 | LL | let e; | ^^^^^^ created here LL | e = format!("{}", d); | ^^^^^^^^^^^^^^^^^^^^ initialised here | help: move the declaration `e` here | LL ~ LL ~ let e = format!("{}", d); | error: unneeded late initialization --> tests/ui/needless_late_init.rs:43:5 | LL | let a; | ^^^^^^ | help: move the declaration `a` here and remove the assignments from the `match` arms | LL ~ LL | let n = 1; LL ~ let a = match n { LL ~ 1 => "one", LL | _ => { LL ~ "two" LL | }, LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:52:5 | LL | let b; | ^^^^^^ | help: move the declaration `b` here and remove the assignments from the branches | LL ~ LL ~ let b = if n == 3 { LL ~ "four" LL | } else { LL ~ "five" LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:59:5 | LL | let d; | ^^^^^^ | help: move the declaration `d` here and remove the assignments from the branches | LL ~ LL ~ let d = if true { LL | let temp = 5; LL ~ temp LL | } else { LL ~ 15 LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:67:5 | LL | let e; | ^^^^^^ | help: move the declaration `e` here and remove the assignments from the branches | LL ~ LL ~ let e = if true { LL ~ format!("{} {}", a, b) LL | } else { LL ~ format!("{}", n) LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:74:5 | LL | let f; | ^^^^^^ | help: move the declaration `f` here and remove the assignments from the `match` arms | LL ~ LL ~ let f = match 1 { LL ~ 1 => "three", | error: unneeded late initialization --> tests/ui/needless_late_init.rs:80:5 | LL | let g: usize; | ^^^^^^^^^^^^^ | help: move the declaration `g` here and remove the assignments from the branches | LL ~ LL ~ let g: usize = if true { LL ~ 5 LL | } else { LL | panic!(); LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:88:5 | LL | let x; | ^^^^^^ created here LL | let y = SignificantDrop; LL | x = 1; | ^^^^^ initialised here | help: move the declaration `x` here | LL ~ LL | let y = SignificantDrop; LL ~ let x = 1; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:92:5 | LL | let x; | ^^^^^^ created here LL | let y = 1; LL | x = SignificantDrop; | ^^^^^^^^^^^^^^^^^^^ initialised here | help: move the declaration `x` here | LL ~ LL | let y = 1; LL ~ let x = SignificantDrop; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:96:5 | LL | let x; | ^^^^^^ created here ... LL | x = SignificantDrop; | ^^^^^^^^^^^^^^^^^^^ initialised here | help: move the declaration `x` here | LL ~ LL | // types that should be considered insignificant ... LL | let y = Box::new(4); LL ~ let x = SignificantDrop; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:115:5 | LL | let a; | ^^^^^^ | help: move the declaration `a` here and remove the assignments from the `match` arms | LL ~ LL | let n = 1; LL ~ let a = match n { LL ~ 1 => f().await, LL | _ => { LL ~ "two" LL | }, LL ~ }; | error: unneeded late initialization --> tests/ui/needless_late_init.rs:132:5 | LL | let a; | ^^^^^^ | help: move the declaration `a` here and remove the assignments from the `match` arms | LL ~ LL | let n = 1; LL ~ let a = match n { LL ~ 1 => f(), LL | _ => { LL ~ "two" LL | }, LL ~ }; | error: aborting due to 16 previous errors