blob: 3f4e86917603c283e2d42730cace41f9f4bd1bac (
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
|
### What it does
Checks for `else` blocks that can be removed without changing semantics.
### Why is this bad?
The `else` block adds unnecessary indentation and verbosity.
### Known problems
Some may prefer to keep the `else` block for clarity.
### Example
```
fn my_func(count: u32) {
if count == 0 {
print!("Nothing to do");
return;
} else {
print!("Moving on...");
}
}
```
Use instead:
```
fn my_func(count: u32) {
if count == 0 {
print!("Nothing to do");
return;
}
print!("Moving on...");
}
```
|