diff options
Diffstat (limited to 'src/tools/clippy/src/docs/if_not_else.txt')
-rw-r--r-- | src/tools/clippy/src/docs/if_not_else.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/if_not_else.txt b/src/tools/clippy/src/docs/if_not_else.txt new file mode 100644 index 000000000..0e5ac4ce6 --- /dev/null +++ b/src/tools/clippy/src/docs/if_not_else.txt @@ -0,0 +1,25 @@ +### What it does +Checks for usage of `!` or `!=` in an if condition with an +else branch. + +### Why is this bad? +Negations reduce the readability of statements. + +### Example +``` +if !v.is_empty() { + a() +} else { + b() +} +``` + +Could be written: + +``` +if v.is_empty() { + b() +} else { + a() +} +```
\ No newline at end of file |