diff options
Diffstat (limited to 'src/tools/clippy/src/docs/collapsible_if.txt')
-rw-r--r-- | src/tools/clippy/src/docs/collapsible_if.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/collapsible_if.txt b/src/tools/clippy/src/docs/collapsible_if.txt new file mode 100644 index 000000000..e1264ee06 --- /dev/null +++ b/src/tools/clippy/src/docs/collapsible_if.txt @@ -0,0 +1,23 @@ +### What it does +Checks for nested `if` statements which can be collapsed +by `&&`-combining their conditions. + +### Why is this bad? +Each `if`-statement adds one level of nesting, which +makes code look more complex than it really is. + +### Example +``` +if x { + if y { + // … + } +} +``` + +Use instead: +``` +if x && y { + // … +} +```
\ No newline at end of file |