From c22ff6cd6e9dd19b31f85b9464a986023d732944 Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Thu, 17 Mar 2022 19:52:07 +0100 Subject: [PATCH] fix: fix clippy_lints --- clippy_lints/src/use_unwrap_or.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clippy_lints/src/use_unwrap_or.rs b/clippy_lints/src/use_unwrap_or.rs index 29bdec2cae8..e4276551242 100644 --- a/clippy_lints/src/use_unwrap_or.rs +++ b/clippy_lints/src/use_unwrap_or.rs @@ -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::(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"]