2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:27:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | let a;
|
2022-06-04 06:34:07 -05:00
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | a = "zero";
|
|
|
|
| ^^^^^^^^^^ initialised here
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::needless-late-init` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_late_init)]`
|
2021-12-06 05:33:31 -06:00
|
|
|
help: declare `a` here
|
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
LL | let a = "zero";
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:30:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let b;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | let c;
|
|
|
|
LL | b = 1;
|
|
|
|
| ^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `b` here
|
|
|
|
|
|
|
|
|
LL | let b = 1;
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:31:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let c;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | b = 1;
|
|
|
|
LL | c = 2;
|
|
|
|
| ^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `c` here
|
|
|
|
|
|
|
|
|
LL | let c = 2;
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:35:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let d: usize;
|
|
|
|
| ^^^^^^^^^^^^^ created here
|
|
|
|
LL | d = 1;
|
|
|
|
| ^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `d` here
|
|
|
|
|
|
|
|
|
LL | let d: usize = 1;
|
|
|
|
| ~~~~~~~~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:38:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let e;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | e = format!("{}", d);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `e` here
|
|
|
|
|
|
|
|
|
LL | let e = format!("{}", d);
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:43:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let a;
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
help: declare `a` here
|
|
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
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 | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:52:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
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 | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:59:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
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 | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:67:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
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 {
|
2022-05-05 09:12:52 -05:00
|
|
|
LL ~ format!("{}", n)
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
|
|
|
|
LL | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:74:5
|
2021-12-17 06:40:22 -06:00
|
|
|
|
|
|
|
|
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",
|
2022-06-15 06:15:54 -05:00
|
|
|
|
|
2021-12-17 06:40:22 -06:00
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:80:5
|
2021-12-17 06:40:22 -06:00
|
|
|
|
|
|
|
|
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
|
2022-06-15 06:15:54 -05:00
|
|
|
|
|
2021-12-17 06:40:22 -06:00
|
|
|
help: add a semicolon after the `if` expression
|
|
|
|
|
|
|
|
|
LL | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:88:5
|
2022-05-05 09:12:52 -05:00
|
|
|
|
|
|
|
|
LL | let x;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | let y = SignificantDrop;
|
|
|
|
LL | x = 1;
|
|
|
|
| ^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `x` here
|
|
|
|
|
|
|
|
|
LL | let x = 1;
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:92:5
|
2022-05-05 09:12:52 -05:00
|
|
|
|
|
|
|
|
LL | let x;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
LL | let y = 1;
|
|
|
|
LL | x = SignificantDrop;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `x` here
|
|
|
|
|
|
|
|
|
LL | let x = SignificantDrop;
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:96:5
|
2022-05-05 09:12:52 -05:00
|
|
|
|
|
|
|
|
LL | let x;
|
|
|
|
| ^^^^^^ created here
|
|
|
|
...
|
|
|
|
LL | x = SignificantDrop;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^ initialised here
|
|
|
|
|
|
|
|
|
help: declare `x` here
|
|
|
|
|
|
|
|
|
LL | let x = SignificantDrop;
|
|
|
|
| ~~~~~
|
|
|
|
|
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:115:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
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 | };
|
|
|
|
| +
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: unneeded late initialization
|
2024-02-17 06:16:29 -06:00
|
|
|
--> tests/ui/needless_late_init.rs:132:5
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
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 | };
|
|
|
|
| +
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
error: aborting due to 16 previous errors
|
2021-12-06 05:33:31 -06:00
|
|
|
|