Skip to content

Commit 307b800

Browse files
committed
unwrap_used: Fix doc to not recommend expect when expect_used is not allowed
1 parent 3e52031 commit 307b800

File tree

1 file changed

+10
-1
lines changed
  • clippy_lints/src/methods

1 file changed

+10
-1
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,22 @@ declare_clippy_lint! {
197197
/// result.unwrap();
198198
/// ```
199199
///
200-
/// Use instead:
200+
/// If [expect_used](#expect_used) is allowed, instead:
201201
/// ```rust
202202
/// # let option = Some(1);
203203
/// # let result: Result<usize, ()> = Ok(1);
204204
/// option.expect("more helpful message");
205205
/// result.expect("more helpful message");
206206
/// ```
207+
///
208+
/// Otherwise try using
209+
/// ```rust
210+
/// option?;
211+
///
212+
/// // or
213+
///
214+
/// result?;
215+
/// ```
207216
#[clippy::version = "1.45.0"]
208217
pub UNWRAP_USED,
209218
restriction,

0 commit comments

Comments
 (0)