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)
     ///     }
     /// }
     ///