@@ -874,33 +874,6 @@ bounds instead of overflowing.
874874
875875Basic usage:
876876
877- ```
878- " , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_add(1), 101);
879- assert_eq!(" , stringify!( $SelfT) , "::max_value().saturating_add(100), " , stringify!( $SelfT) ,
880- "::max_value());" ,
881- $EndFeature, "
882- ```" ) ,
883- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
884- #[ inline]
885- #[ cfg( stage0) ]
886- pub fn saturating_add( self , rhs: Self ) -> Self {
887- match self . checked_add( rhs) {
888- Some ( x) => x,
889- None if rhs >= 0 => Self :: max_value( ) ,
890- None => Self :: min_value( ) ,
891- }
892- }
893-
894- }
895-
896- doc_comment! {
897- concat!( "Saturating integer addition. Computes `self + rhs`, saturating at the numeric
898- bounds instead of overflowing.
899-
900- # Examples
901-
902- Basic usage:
903-
904877```
905878" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_add(1), 101);
906879assert_eq!(" , stringify!( $SelfT) , "::max_value().saturating_add(100), " , stringify!( $SelfT) ,
@@ -911,37 +884,11 @@ $EndFeature, "
911884 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
912885 #[ rustc_const_unstable( feature = "const_saturating_int_methods" ) ]
913886 #[ inline]
914- #[ cfg( not( stage0) ) ]
915887 pub const fn saturating_add( self , rhs: Self ) -> Self {
916888 intrinsics:: saturating_add( self , rhs)
917889 }
918890 }
919891
920- doc_comment! {
921- concat!( "Saturating integer subtraction. Computes `self - rhs`, saturating at the
922- numeric bounds instead of overflowing.
923-
924- # Examples
925-
926- Basic usage:
927-
928- ```
929- " , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_sub(127), -27);
930- assert_eq!(" , stringify!( $SelfT) , "::min_value().saturating_sub(100), " , stringify!( $SelfT) ,
931- "::min_value());" ,
932- $EndFeature, "
933- ```" ) ,
934- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
935- #[ inline]
936- #[ cfg( stage0) ]
937- pub fn saturating_sub( self , rhs: Self ) -> Self {
938- match self . checked_sub( rhs) {
939- Some ( x) => x,
940- None if rhs >= 0 => Self :: min_value( ) ,
941- None => Self :: max_value( ) ,
942- }
943- }
944- }
945892
946893 doc_comment! {
947894 concat!( "Saturating integer subtraction. Computes `self - rhs`, saturating at the
@@ -960,7 +907,6 @@ $EndFeature, "
960907 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
961908 #[ rustc_const_unstable( feature = "const_saturating_int_methods" ) ]
962909 #[ inline]
963- #[ cfg( not( stage0) ) ]
964910 pub const fn saturating_sub( self , rhs: Self ) -> Self {
965911 intrinsics:: saturating_sub( self , rhs)
966912 }
@@ -2780,29 +2726,6 @@ the numeric bounds instead of overflowing.
27802726
27812727Basic usage:
27822728
2783- ```
2784- " , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_add(1), 101);
2785- assert_eq!(200u8.saturating_add(127), 255);" , $EndFeature, "
2786- ```" ) ,
2787- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2788- #[ inline]
2789- #[ cfg( stage0) ]
2790- pub fn saturating_add( self , rhs: Self ) -> Self {
2791- match self . checked_add( rhs) {
2792- Some ( x) => x,
2793- None => Self :: max_value( ) ,
2794- }
2795- }
2796- }
2797-
2798- doc_comment! {
2799- concat!( "Saturating integer addition. Computes `self + rhs`, saturating at
2800- the numeric bounds instead of overflowing.
2801-
2802- # Examples
2803-
2804- Basic usage:
2805-
28062729```
28072730" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_add(1), 101);
28082731assert_eq!(200u8.saturating_add(127), 255);" , $EndFeature, "
@@ -2811,7 +2734,6 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, "
28112734 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
28122735 #[ rustc_const_unstable( feature = "const_saturating_int_methods" ) ]
28132736 #[ inline]
2814- #[ cfg( not( stage0) ) ]
28152737 pub const fn saturating_add( self , rhs: Self ) -> Self {
28162738 intrinsics:: saturating_add( self , rhs)
28172739 }
@@ -2825,37 +2747,13 @@ at the numeric bounds instead of overflowing.
28252747
28262748Basic usage:
28272749
2828- ```
2829- " , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_sub(27), 73);
2830- assert_eq!(13" , stringify!( $SelfT) , ".saturating_sub(127), 0);" , $EndFeature, "
2831- ```" ) ,
2832- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2833- #[ inline]
2834- #[ cfg( stage0) ]
2835- pub fn saturating_sub( self , rhs: Self ) -> Self {
2836- match self . checked_sub( rhs) {
2837- Some ( x) => x,
2838- None => Self :: min_value( ) ,
2839- }
2840- }
2841- }
2842-
2843- doc_comment! {
2844- concat!( "Saturating integer subtraction. Computes `self - rhs`, saturating
2845- at the numeric bounds instead of overflowing.
2846-
2847- # Examples
2848-
2849- Basic usage:
2850-
28512750```
28522751" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_sub(27), 73);
28532752assert_eq!(13" , stringify!( $SelfT) , ".saturating_sub(127), 0);" , $EndFeature, "
28542753```" ) ,
28552754 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
28562755 #[ rustc_const_unstable( feature = "const_saturating_int_methods" ) ]
28572756 #[ inline]
2858- #[ cfg( not( stage0) ) ]
28592757 pub const fn saturating_sub( self , rhs: Self ) -> Self {
28602758 intrinsics:: saturating_sub( self , rhs)
28612759 }
0 commit comments