summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/manual_filter.fixed
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/tools/clippy/tests/ui/manual_filter.fixed
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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)
}