about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-19 08:17:19 +0100
committerGitHub <noreply@github.com>2025-03-19 08:17:19 +0100
commit3b7faca09c7a2e86390e354e83cb1acac6b3a1fd (patch)
treecad43d9ea3135c1d732fd4aba47d71dec73d6ee8
parent5661e980582d4285c7af88a79ee8438fa21e3cde (diff)
parent7a8cdf00e64fb35756cb2d3509fc254cc3529143 (diff)
downloadrust-3b7faca09c7a2e86390e354e83cb1acac6b3a1fd.tar.gz
rust-3b7faca09c7a2e86390e354e83cb1acac6b3a1fd.zip
Rollup merge of #138684 - bend-n:use_then, r=jhpratt
use then in docs for `fuse` to enhance readability

use the more-idiomatic `then_some` rather than an `if { some } else { none }` for `fused` docs
-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)
     ///     }
     /// }
     ///