From 774a79e3fd40dee6dcdb80ef57e9e49a6d38d381 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 17 Jul 2021 00:19:44 +0800 Subject: [PATCH] Mark `Option::insert` as must_use --- library/core/src/option.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index b7af3ea8c1af4..d130854911322 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1179,6 +1179,7 @@ impl Option { /// *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 {