Skip to content

Commit c22ff6c

Browse files
committed
fix: fix clippy_lints
1 parent 747bb24 commit c22ff6c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clippy_lints/src/use_unwrap_or.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,25 @@ declare_clippy_lint! {
1515
///
1616
/// ### Example
1717
/// ```rust
18+
/// # let fallback = "fallback";
1819
/// // Result
20+
/// # type Error = &'static str;
21+
/// # let result: Result<&str, Error> = Err("error");
1922
/// let port = result.or::<Error>(Ok(fallback)).unwrap();
2023
///
2124
/// // Option
25+
/// # let option: Option<&str> = None;
2226
/// let value = option.or(Some(fallback)).unwrap();
2327
/// ```
2428
/// Use instead:
2529
/// ```rust
30+
/// # let fallback = "fallback";
2631
/// // Result
32+
/// # let result: Result<&str, &str> = Err("error");
2733
/// let port = result.unwrap_or(fallback);
2834
///
2935
/// // Option
36+
/// # let option: Option<&str> = None;
3037
/// let value = option.unwrap_or(fallback);
3138
/// ```
3239
#[clippy::version = "1.61.0"]

0 commit comments

Comments
 (0)