Mark Option::insert as must_use

This commit is contained in:
oxalica 2021-07-17 00:19:44 +08:00
parent a6470c7fa8
commit 774a79e3fd
No known key found for this signature in database
GPG key ID: CED392DE0C483D00

View file

@ -1179,6 +1179,7 @@ impl<T> Option<T> {
/// *val = 3;
/// assert_eq!(opt.unwrap(), 3);
/// ```
#[must_use = "if you intended to set a value, consider assignment instead"]
#[inline]
#[stable(feature = "option_insert", since = "1.53.0")]
pub fn insert(&mut self, value: T) -> &mut T {