File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,25 @@ declare_clippy_lint! {
15
15
///
16
16
/// ### Example
17
17
/// ```rust
18
+ /// # let fallback = "fallback";
18
19
/// // Result
20
+ /// # type Error = &'static str;
21
+ /// # let result: Result<&str, Error> = Err("error");
19
22
/// let port = result.or::<Error>(Ok(fallback)).unwrap();
20
23
///
21
24
/// // Option
25
+ /// # let option: Option<&str> = None;
22
26
/// let value = option.or(Some(fallback)).unwrap();
23
27
/// ```
24
28
/// Use instead:
25
29
/// ```rust
30
+ /// # let fallback = "fallback";
26
31
/// // Result
32
+ /// # let result: Result<&str, &str> = Err("error");
27
33
/// let port = result.unwrap_or(fallback);
28
34
///
29
35
/// // Option
36
+ /// # let option: Option<&str> = None;
30
37
/// let value = option.unwrap_or(fallback);
31
38
/// ```
32
39
#[ clippy:: version = "1.61.0" ]
You can’t perform that action at this time.
0 commit comments