mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
fix: fix clippy_lints
This commit is contained in:
parent
747bb245e7
commit
c22ff6cd6e
1 changed files with 7 additions and 0 deletions
|
@ -15,18 +15,25 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
/// # let fallback = "fallback";
|
||||
/// // Result
|
||||
/// # type Error = &'static str;
|
||||
/// # let result: Result<&str, Error> = Err("error");
|
||||
/// let port = result.or::<Error>(Ok(fallback)).unwrap();
|
||||
///
|
||||
/// // Option
|
||||
/// # let option: Option<&str> = None;
|
||||
/// let value = option.or(Some(fallback)).unwrap();
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust
|
||||
/// # let fallback = "fallback";
|
||||
/// // Result
|
||||
/// # let result: Result<&str, &str> = Err("error");
|
||||
/// let port = result.unwrap_or(fallback);
|
||||
///
|
||||
/// // Option
|
||||
/// # let option: Option<&str> = None;
|
||||
/// let value = option.unwrap_or(fallback);
|
||||
/// ```
|
||||
#[clippy::version = "1.61.0"]
|
||||
|
|
Loading…
Reference in a new issue