From 307b800f27aaab6363ad5ca09009a71852f6d7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Thu, 28 Jul 2022 22:08:48 +0200 Subject: [PATCH] unwrap_used: Fix doc to not recommend expect when expect_used is not allowed --- clippy_lints/src/methods/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 202fbc1f7f66..05f20e6cb9c5 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -197,13 +197,22 @@ declare_clippy_lint! { /// result.unwrap(); /// ``` /// - /// Use instead: + /// If [expect_used](#expect_used) is allowed, instead: /// ```rust /// # let option = Some(1); /// # let result: Result = Ok(1); /// option.expect("more helpful message"); /// result.expect("more helpful message"); /// ``` + /// + /// Otherwise try using + /// ```rust + /// option?; + /// + /// // or + /// + /// result?; + /// ``` #[clippy::version = "1.45.0"] pub UNWRAP_USED, restriction,