diff options
Diffstat (limited to 'src/docs/unnested_or_patterns.txt')
| -rw-r--r-- | src/docs/unnested_or_patterns.txt | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/docs/unnested_or_patterns.txt b/src/docs/unnested_or_patterns.txt deleted file mode 100644 index 49c45d4ee5e..00000000000 --- a/src/docs/unnested_or_patterns.txt +++ /dev/null @@ -1,22 +0,0 @@ -### What it does -Checks for unnested or-patterns, e.g., `Some(0) | Some(2)` and -suggests replacing the pattern with a nested one, `Some(0 | 2)`. - -Another way to think of this is that it rewrites patterns in -*disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*. - -### Why is this bad? -In the example above, `Some` is repeated, which unnecessarily complicates the pattern. - -### Example -``` -fn main() { - if let Some(0) | Some(2) = Some(0) {} -} -``` -Use instead: -``` -fn main() { - if let Some(0 | 2) = Some(0) {} -} -``` \ No newline at end of file |
