about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbendn <bend.n@outlook.com>2025-03-19 10:45:42 +0700
committerbendn <bend.n@outlook.com>2025-03-19 10:45:42 +0700
commit7a8cdf00e64fb35756cb2d3509fc254cc3529143 (patch)
tree02415955da0ac4f04a05f8362497512b5a0a25b2
parent75530e9f72a1990ed2305e16fd51d02f47048f12 (diff)
downloadrust-7a8cdf00e64fb35756cb2d3509fc254cc3529143.tar.gz
rust-7a8cdf00e64fb35756cb2d3509fc254cc3529143.zip
use then
-rw-r--r--library/core/src/iter/traits/iterator.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 075da022854..3bbb52fdbcb 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1704,11 +1704,7 @@ pub trait Iterator {
     ///         self.state = self.state + 1;
     ///
     ///         // if it's even, Some(i32), else None
-    ///         if val % 2 == 0 {
-    ///             Some(val)
-    ///         } else {
-    ///             None
-    ///         }
+    ///         (val % 2 == 0).then_some(val)
     ///     }
     /// }
     ///