Skip to content

Commit

Permalink
Update Ord::min and Ord::max to match
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Dec 18, 2022
1 parent d409475 commit 2f7cea4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,25 @@ mod impls {
// SAFETY: The discriminants of Ord were chosen to permit this
unsafe { crate::mem::transmute(res) }
}

#[inline]
fn max(self, other: Self) -> Self {
if self > other {
self
} else {
other
}
}

#[inline]
fn min(self, other: Self) -> Self {
if self > other {
other
} else {
self
}
}

}
)*)
}
Expand Down

0 comments on commit 2f7cea4

Please sign in to comment.