unwrap_used: Fix doc to not recommend expect when expect_used is not allowed

This commit is contained in:
Sosthène Guédon 2022-07-28 22:08:48 +02:00
parent 3e52031471
commit 307b800f27

View File

@ -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<usize, ()> = 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,