File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -714,6 +714,8 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
714
714
///
715
715
/// Returns the first argument if the comparison determines them to be equal.
716
716
///
717
+ /// Internally uses an alias to `Ord::min`.
718
+ ///
717
719
/// # Examples
718
720
///
719
721
/// ```
@@ -725,13 +727,15 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
725
727
#[ inline]
726
728
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
727
729
pub fn min < T : Ord > ( v1 : T , v2 : T ) -> T {
728
- if v1 <= v2 { v1 } else { v2 }
730
+ v1 . min ( v2 )
729
731
}
730
732
731
733
/// Compares and returns the maximum of two values.
732
734
///
733
735
/// Returns the second argument if the comparison determines them to be equal.
734
736
///
737
+ /// Internally uses an alias to `Ord::max`.
738
+ ///
735
739
/// # Examples
736
740
///
737
741
/// ```
@@ -743,7 +747,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
743
747
#[ inline]
744
748
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
745
749
pub fn max < T : Ord > ( v1 : T , v2 : T ) -> T {
746
- if v2 >= v1 { v2 } else { v1 }
750
+ v1 . max ( v2 )
747
751
}
748
752
749
753
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
You can’t perform that action at this time.
0 commit comments