add same warning to Result::expect as Result::unwrap

This commit is contained in:
Nathan Stocks 2022-07-21 18:15:24 -06:00
parent 62b272d25c
commit 7ba0be832a

View File

@ -1009,6 +1009,15 @@ pub fn iter_mut(&mut self) -> IterMut<'_, T> {
/// Returns the contained [`Ok`] value, consuming the `self` value.
///
/// Because this function may panic, its use is generally discouraged.
/// Instead, prefer to use pattern matching and handle the [`Err`]
/// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or
/// [`unwrap_or_default`].
///
/// [`unwrap_or`]: Result::unwrap_or
/// [`unwrap_or_else`]: Result::unwrap_or_else
/// [`unwrap_or_default`]: Result::unwrap_or_default
///
/// # Panics
///
/// Panics if the value is an [`Err`], with a panic message including the