summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/manual_filter.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/manual_filter.fixed')
-rw-r--r--src/tools/clippy/tests/ui/manual_filter.fixed41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/manual_filter.fixed b/src/tools/clippy/tests/ui/manual_filter.fixed
index 3553291b8..ef6780dc9 100644
--- a/src/tools/clippy/tests/ui/manual_filter.fixed
+++ b/src/tools/clippy/tests/ui/manual_filter.fixed
@@ -116,4 +116,45 @@ fn main() {
},
None => None,
};
+
+ match Some(20) {
+ // Don't Lint, because `Some(3*x)` is not `None`
+ None => None,
+ Some(x) => {
+ if x > 0 {
+ Some(3 * x)
+ } else {
+ Some(x)
+ }
+ },
+ };
+
+ // Don't lint: https://github.com/rust-lang/rust-clippy/issues/10088
+ let result = if let Some(a) = maybe_some() {
+ if let Some(b) = maybe_some() {
+ Some(a + b)
+ } else {
+ Some(a)
+ }
+ } else {
+ None
+ };
+
+ let allowed_integers = vec![3, 4, 5, 6];
+ // Don't lint, since there's a side effect in the else branch
+ match Some(21) {
+ Some(x) => {
+ if allowed_integers.contains(&x) {
+ Some(x)
+ } else {
+ println!("Invalid integer: {x:?}");
+ None
+ }
+ },
+ None => None,
+ };
+}
+
+fn maybe_some() -> Option<u32> {
+ Some(0)
}