Skip to content

Commit b0daec5

Browse files
committed
Fix example
1 parent 2b2b037 commit b0daec5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clippy_lints/src/manual_option_folding.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ declare_clippy_lint! {
1717
///
1818
/// ### Example
1919
/// ```rust
20-
/// // foo: impl Fn() -> X
21-
/// // def: impl Fn() -> X
22-
/// let mut opt: Option<X> = foo();
23-
/// opt.get_or_insert_with(|| def());
24-
/// let res: X = unsafe { opt.unwrap_unchecked() };
20+
/// let mut opt: Option<i32> = None;
21+
/// opt.get_or_insert(42);
22+
/// let res = unsafe { opt.unwrap_unchecked() };
2523
/// ```
2624
/// Use instead:
2725
/// ```rust
28-
/// let res: X = foo().unwrap_or_else(|| def());
26+
/// let opt = Option<i32> = None;
27+
/// let res: i32 = foo().unwrap_or(42);
2928
/// ```
3029
#[clippy::version = "1.74.0"]
3130
pub MANUAL_OPTION_FOLDING,

0 commit comments

Comments
 (0)