summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/suspicious_else_formatting.txt
blob: 3cf2f74868ebfb4e5faed85fef5190dd50e588c0 (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 formatting of `else`. It lints if the `else`
is followed immediately by a newline or the `else` seems to be missing.

### Why is this bad?
This is probably some refactoring remnant, even if the
code is correct, it might look confusing.

### Example
```
if foo {
} { // looks like an `else` is missing here
}

if foo {
} if bar { // looks like an `else` is missing here
}

if foo {
} else

{ // this is the `else` block of the previous `if`, but should it be?
}

if foo {
} else

if bar { // this is the `else` block of the previous `if`, but should it be?
}
```