diff options
Diffstat (limited to 'src/tools/clippy/src/docs/obfuscated_if_else.txt')
-rw-r--r-- | src/tools/clippy/src/docs/obfuscated_if_else.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/obfuscated_if_else.txt b/src/tools/clippy/src/docs/obfuscated_if_else.txt new file mode 100644 index 000000000..638f63b0d --- /dev/null +++ b/src/tools/clippy/src/docs/obfuscated_if_else.txt @@ -0,0 +1,21 @@ +### What it does +Checks for usages of `.then_some(..).unwrap_or(..)` + +### Why is this bad? +This can be written more clearly with `if .. else ..` + +### Limitations +This lint currently only looks for usages of +`.then_some(..).unwrap_or(..)`, but will be expanded +to account for similar patterns. + +### Example +``` +let x = true; +x.then_some("a").unwrap_or("b"); +``` +Use instead: +``` +let x = true; +if x { "a" } else { "b" }; +```
\ No newline at end of file |