File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -18,16 +18,16 @@ impl bool {
18
18
/// assert_eq!(false.then_some(0), None);
19
19
/// assert_eq!(true.then_some(0), Some(0));
20
20
/// ```
21
- ///
21
+ ///
22
22
/// ```
23
23
/// let mut a = 0;
24
24
/// let mut function_with_side_effects = || { a += 1; };
25
- ///
25
+ ///
26
26
/// true.then_some(function_with_side_effects());
27
27
/// false.then_some(function_with_side_effects());
28
- ///
29
- /// // `a` is incremented twice because the value passed to `then_some` is
30
- /// // evaluated eagerly.
28
+ ///
29
+ /// // `a` is incremented twice because the value passed to `then_some` is
30
+ /// // evaluated eagerly.
31
31
/// assert_eq!(a, 2);
32
32
/// ```
33
33
#[ stable( feature = "bool_to_option" , since = "1.62.0" ) ]
@@ -49,14 +49,14 @@ impl bool {
49
49
/// assert_eq!(false.then(|| 0), None);
50
50
/// assert_eq!(true.then(|| 0), Some(0));
51
51
/// ```
52
- ///
52
+ ///
53
53
/// ```
54
54
/// let mut a = 0;
55
- ///
55
+ ///
56
56
/// true.then(|| { a += 1; });
57
57
/// false.then(|| { a += 1; });
58
- ///
59
- /// // `a` is incremented once because the closure is evaluated lazily by
58
+ ///
59
+ /// // `a` is incremented once because the closure is evaluated lazily by
60
60
/// // `then`.
61
61
/// ```
62
62
#[ stable( feature = "lazy_bool_to_option" , since = "1.50.0" ) ]
You can’t perform that action at this time.
0 commit comments