mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
unwrap_used: Fix doc to not recommend expect when expect_used is not allowed
This commit is contained in:
parent
3e52031471
commit
307b800f27
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user