]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/suspicious_else_formatting.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / suspicious_else_formatting.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for formatting of `else`. It lints if the `else`
3is followed immediately by a newline or the `else` seems to be missing.
4
5### Why is this bad?
6This is probably some refactoring remnant, even if the
7code is correct, it might look confusing.
8
9### Example
10```
11if foo {
12} { // looks like an `else` is missing here
13}
14
15if foo {
16} if bar { // looks like an `else` is missing here
17}
18
19if foo {
20} else
21
22{ // this is the `else` block of the previous `if`, but should it be?
23}
24
25if foo {
26} else
27
28if bar { // this is the `else` block of the previous `if`, but should it be?
29}
30```