From e937802767daedee9de0df67b53cedb2824b96e7 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Sun, 10 Mar 2024 17:35:22 -0400 Subject: [PATCH] add #[inline] to Option::copied/cloned --- library/core/src/option.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 5027e326a9d7a..2907388f08b2e 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1857,6 +1857,7 @@ impl Option<&T> { /// let copied = opt_x.copied(); /// assert_eq!(copied, Some(12)); /// ``` + #[inline] #[must_use = "`self` will be dropped if the result is not used"] #[stable(feature = "copied", since = "1.35.0")] #[rustc_const_unstable(feature = "const_option", issue = "67441")] @@ -1884,6 +1885,7 @@ impl Option<&T> { /// let cloned = opt_x.cloned(); /// assert_eq!(cloned, Some(12)); /// ``` + #[inline] #[must_use = "`self` will be dropped if the result is not used"] #[stable(feature = "rust1", since = "1.0.0")] pub fn cloned(self) -> Option @@ -1910,6 +1912,7 @@ impl Option<&mut T> { /// let copied = opt_x.copied(); /// assert_eq!(copied, Some(12)); /// ``` + #[inline] #[must_use = "`self` will be dropped if the result is not used"] #[stable(feature = "copied", since = "1.35.0")] #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")] @@ -1935,6 +1938,7 @@ impl Option<&mut T> { /// let cloned = opt_x.cloned(); /// assert_eq!(cloned, Some(12)); /// ``` + #[inline] #[must_use = "`self` will be dropped if the result is not used"] #[stable(since = "1.26.0", feature = "option_ref_mut_cloned")] pub fn cloned(self) -> Option