Optimization for bool's PartialOrd impl

This commit is contained in:
Chayim Refael Friedman 2020-12-14 21:01:19 +02:00
parent 1f7762b4fc
commit 777ca999a9

View File

@ -1236,7 +1236,7 @@ fn partial_cmp(&self, _: &()) -> Option<Ordering> {
impl PartialOrd for bool {
#[inline]
fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
(*self as u8).partial_cmp(&(*other as u8))
Some(self.cmp(other))
}
}