@@ -67,7 +67,7 @@ impl fmt::Debug for RangeFull {
6767/// assert_eq!(arr[1..3], [ 'b', 'c' ]); // Range
6868/// ```
6969#[ doc( alias = ".." ) ]
70- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
70+ #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
7171#[ stable( feature = "rust1" , since = "1.0.0" ) ]
7272pub struct Range < Idx > {
7373 /// The lower bound of the range (inclusive).
@@ -91,8 +91,6 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
9191 /// # Examples
9292 ///
9393 /// ```
94- /// #![feature(range_contains)]
95- ///
9694 /// use std::f32;
9795 ///
9896 /// assert!(!(3..5).contains(&2));
@@ -108,7 +106,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
108106 /// assert!(!(0.0..f32::NAN).contains(&0.5));
109107 /// assert!(!(f32::NAN..1.0).contains(&0.5));
110108 /// ```
111- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
109+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
112110 pub fn contains < U > ( & self , item : & U ) -> bool
113111 where
114112 Idx : PartialOrd < U > ,
@@ -169,7 +167,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
169167///
170168/// [`Iterator`]: ../iter/trait.IntoIterator.html
171169#[ doc( alias = ".." ) ]
172- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
170+ #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
173171#[ stable( feature = "rust1" , since = "1.0.0" ) ]
174172pub struct RangeFrom < Idx > {
175173 /// The lower bound of the range (inclusive).
@@ -190,8 +188,6 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
190188 /// # Examples
191189 ///
192190 /// ```
193- /// #![feature(range_contains)]
194- ///
195191 /// use std::f32;
196192 ///
197193 /// assert!(!(3..).contains(&2));
@@ -202,7 +198,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
202198 /// assert!(!(0.0..).contains(&f32::NAN));
203199 /// assert!(!(f32::NAN..).contains(&0.5));
204200 /// ```
205- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
201+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
206202 pub fn contains < U > ( & self , item : & U ) -> bool
207203 where
208204 Idx : PartialOrd < U > ,
@@ -272,8 +268,6 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
272268 /// # Examples
273269 ///
274270 /// ```
275- /// #![feature(range_contains)]
276- ///
277271 /// use std::f32;
278272 ///
279273 /// assert!( (..5).contains(&-1_000_000_000));
@@ -284,7 +278,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
284278 /// assert!(!(..1.0).contains(&f32::NAN));
285279 /// assert!(!(..f32::NAN).contains(&0.5));
286280 /// ```
287- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
281+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
288282 pub fn contains < U > ( & self , item : & U ) -> bool
289283 where
290284 Idx : PartialOrd < U > ,
@@ -317,7 +311,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
317311/// assert_eq!(arr[1..=2], [ 1,2 ]); // RangeInclusive
318312/// ```
319313#[ doc( alias = "..=" ) ]
320- #[ derive( Clone ) ] // not Copy -- see #27186
314+ #[ derive( Clone ) ] // not Copy -- see #27186
321315#[ stable( feature = "inclusive_range" , since = "1.26.0" ) ]
322316pub struct RangeInclusive < Idx > {
323317 pub ( crate ) start : Idx ,
@@ -353,7 +347,8 @@ impl<T: PartialOrd> RangeInclusiveEquality for T {
353347impl < Idx : PartialEq > PartialEq for RangeInclusive < Idx > {
354348 #[ inline]
355349 fn eq ( & self , other : & Self ) -> bool {
356- self . start == other. start && self . end == other. end
350+ self . start == other. start
351+ && self . end == other. end
357352 && RangeInclusiveEquality :: canonicalized_is_empty ( self )
358353 == RangeInclusiveEquality :: canonicalized_is_empty ( other)
359354 }
@@ -385,7 +380,11 @@ impl<Idx> RangeInclusive<Idx> {
385380 #[ inline]
386381 #[ rustc_promotable]
387382 pub const fn new ( start : Idx , end : Idx ) -> Self {
388- Self { start, end, is_empty : None }
383+ Self {
384+ start,
385+ end,
386+ is_empty : None ,
387+ }
389388 }
390389
391390 /// Returns the lower bound of the range (inclusive).
@@ -466,8 +465,6 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
466465 /// # Examples
467466 ///
468467 /// ```
469- /// #![feature(range_contains)]
470- ///
471468 /// use std::f32;
472469 ///
473470 /// assert!(!(3..=5).contains(&2));
@@ -484,7 +481,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
484481 /// assert!(!(0.0..=f32::NAN).contains(&0.0));
485482 /// assert!(!(f32::NAN..=1.0).contains(&1.0));
486483 /// ```
487- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
484+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
488485 pub fn contains < U > ( & self , item : & U ) -> bool
489486 where
490487 Idx : PartialOrd < U > ,
@@ -593,15 +590,12 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
593590 }
594591}
595592
596- #[ unstable( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311" ) ]
597593impl < Idx : PartialOrd < Idx > > RangeToInclusive < Idx > {
598594 /// Returns `true` if `item` is contained in the range.
599595 ///
600596 /// # Examples
601597 ///
602598 /// ```
603- /// #![feature(range_contains)]
604- ///
605599 /// use std::f32;
606600 ///
607601 /// assert!( (..=5).contains(&-1_000_000_000));
@@ -612,7 +606,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
612606 /// assert!(!(..=1.0).contains(&f32::NAN));
613607 /// assert!(!(..=f32::NAN).contains(&0.5));
614608 /// ```
615- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
609+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
616610 pub fn contains < U > ( & self , item : & U ) -> bool
617611 where
618612 Idx : PartialOrd < U > ,
@@ -714,14 +708,11 @@ pub trait RangeBounds<T: ?Sized> {
714708 #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
715709 fn end_bound ( & self ) -> Bound < & T > ;
716710
717-
718711 /// Returns `true` if `item` is contained in the range.
719712 ///
720713 /// # Examples
721714 ///
722715 /// ```
723- /// #![feature(range_contains)]
724- ///
725716 /// use std::f32;
726717 ///
727718 /// assert!( (3..5).contains(&4));
@@ -731,7 +722,7 @@ pub trait RangeBounds<T: ?Sized> {
731722 /// assert!(!(0.0..1.0).contains(&f32::NAN));
732723 /// assert!(!(0.0..f32::NAN).contains(&0.5));
733724 /// assert!(!(f32::NAN..1.0).contains(&0.5));
734- #[ unstable ( feature = "range_contains" , reason = "recently added as per RFC" , issue = "32311 ") ]
725+ #[ stable ( feature = "range_contains" , since = "1.35.0 " ) ]
735726 fn contains < U > ( & self , item : & U ) -> bool
736727 where
737728 T : PartialOrd < U > ,
@@ -741,9 +732,7 @@ pub trait RangeBounds<T: ?Sized> {
741732 Included ( ref start) => * start <= item,
742733 Excluded ( ref start) => * start < item,
743734 Unbounded => true ,
744- } )
745- &&
746- ( match self . end_bound ( ) {
735+ } ) && ( match self . end_bound ( ) {
747736 Included ( ref end) => item <= * end,
748737 Excluded ( ref end) => item < * end,
749738 Unbounded => true ,
@@ -819,15 +808,15 @@ impl<T> RangeBounds<T> for (Bound<T>, Bound<T>) {
819808 match * self {
820809 ( Included ( ref start) , _) => Included ( start) ,
821810 ( Excluded ( ref start) , _) => Excluded ( start) ,
822- ( Unbounded , _) => Unbounded ,
811+ ( Unbounded , _) => Unbounded ,
823812 }
824813 }
825814
826815 fn end_bound ( & self ) -> Bound < & T > {
827816 match * self {
828817 ( _, Included ( ref end) ) => Included ( end) ,
829818 ( _, Excluded ( ref end) ) => Excluded ( end) ,
830- ( _, Unbounded ) => Unbounded ,
819+ ( _, Unbounded ) => Unbounded ,
831820 }
832821 }
833822}
0 commit comments