File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 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> {
714714///
715715/// Returns the first argument if the comparison determines them to be equal.
716716///
717+ /// Internally uses an alias to `Ord::min`.
718+ ///
717719/// # Examples
718720///
719721/// ```
@@ -725,13 +727,15 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
725727#[ inline]
726728#[ stable( feature = "rust1" , since = "1.0.0" ) ]
727729pub fn min < T : Ord > ( v1 : T , v2 : T ) -> T {
728- if v1 <= v2 { v1 } else { v2 }
730+ v1 . min ( v2 )
729731}
730732
731733/// Compares and returns the maximum of two values.
732734///
733735/// Returns the second argument if the comparison determines them to be equal.
734736///
737+ /// Internally uses an alias to `Ord::max`.
738+ ///
735739/// # Examples
736740///
737741/// ```
@@ -743,7 +747,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
743747#[ inline]
744748#[ stable( feature = "rust1" , since = "1.0.0" ) ]
745749pub fn max < T : Ord > ( v1 : T , v2 : T ) -> T {
746- if v2 >= v1 { v2 } else { v1 }
750+ v1 . max ( v2 )
747751}
748752
749753// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
You can’t perform that action at this time.
0 commit comments