blob: 9e7bbcea99825cca935a530cf0ec42a8064ab0e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
### What it does
Checks for late initializations that can be replaced by a `let` statement
with an initializer.
### Why is this bad?
Assigning in the `let` statement is less repetitive.
### Example
```
let a;
a = 1;
let b;
match 3 {
0 => b = "zero",
1 => b = "one",
_ => b = "many",
}
let c;
if true {
c = 1;
} else {
c = -1;
}
```
Use instead:
```
let a = 1;
let b = match 3 {
0 => "zero",
1 => "one",
_ => "many",
};
let c = if true {
1
} else {
-1
};
```
|