We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b2b037 commit b0daec5Copy full SHA for b0daec5
clippy_lints/src/manual_option_folding.rs
@@ -17,15 +17,14 @@ declare_clippy_lint! {
17
///
18
/// ### Example
19
/// ```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() };
+ /// let mut opt: Option<i32> = None;
+ /// opt.get_or_insert(42);
+ /// let res = unsafe { opt.unwrap_unchecked() };
25
/// ```
26
/// Use instead:
27
28
- /// let res: X = foo().unwrap_or_else(|| def());
+ /// let opt = Option<i32> = None;
+ /// let res: i32 = foo().unwrap_or(42);
29
30
#[clippy::version = "1.74.0"]
31
pub MANUAL_OPTION_FOLDING,
0 commit comments