Skip to content

Commit 774a79e

Browse files
committed
Mark Option::insert as must_use
1 parent a6470c7 commit 774a79e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: library/core/src/option.rs

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

0 commit comments

Comments
 (0)