From 2820568c2d57a28305541476fee41ea926ed55d9 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sun, 22 Oct 2023 00:29:45 -0400 Subject: [PATCH] Add #[inline] to some recalcitrant ops::range methods --- library/core/src/ops/range.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/ops/range.rs b/library/core/src/ops/range.rs index b41600958876b..b419a738fbe3a 100644 --- a/library/core/src/ops/range.rs +++ b/library/core/src/ops/range.rs @@ -115,6 +115,7 @@ impl> Range { /// assert!(!(0.0..f32::NAN).contains(&0.5)); /// assert!(!(f32::NAN..1.0).contains(&0.5)); /// ``` + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] pub fn contains(&self, item: &U) -> bool where @@ -141,6 +142,7 @@ impl> Range { /// assert!( (3.0..f32::NAN).is_empty()); /// assert!( (f32::NAN..5.0).is_empty()); /// ``` + #[inline] #[stable(feature = "range_is_empty", since = "1.47.0")] pub fn is_empty(&self) -> bool { !(self.start < self.end) @@ -213,6 +215,7 @@ impl> RangeFrom { /// assert!(!(0.0..).contains(&f32::NAN)); /// assert!(!(f32::NAN..).contains(&0.5)); /// ``` + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] pub fn contains(&self, item: &U) -> bool where @@ -294,6 +297,7 @@ impl> RangeTo { /// assert!(!(..1.0).contains(&f32::NAN)); /// assert!(!(..f32::NAN).contains(&0.5)); /// ``` + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] pub fn contains(&self, item: &U) -> bool where @@ -500,6 +504,7 @@ impl> RangeInclusive { /// // Precise field values are unspecified here /// assert!(!r.contains(&3) && !r.contains(&5)); /// ``` + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] pub fn contains(&self, item: &U) -> bool where @@ -613,6 +618,7 @@ impl> RangeToInclusive { /// assert!(!(..=1.0).contains(&f32::NAN)); /// assert!(!(..=f32::NAN).contains(&0.5)); /// ``` + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] pub fn contains(&self, item: &U) -> bool where @@ -808,6 +814,7 @@ pub trait RangeBounds { /// assert!(!(0.0..1.0).contains(&f32::NAN)); /// assert!(!(0.0..f32::NAN).contains(&0.5)); /// assert!(!(f32::NAN..1.0).contains(&0.5)); + #[inline] #[stable(feature = "range_contains", since = "1.35.0")] fn contains(&self, item: &U) -> bool where