From 777ca999a999a601b1b4eb3b6147fa77d2ea902c Mon Sep 17 00:00:00 2001 From: Chayim Refael Friedman Date: Mon, 14 Dec 2020 21:01:19 +0200 Subject: [PATCH] Optimization for bool's PartialOrd impl --- library/core/src/cmp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index f752472c3ba80..0c459a820c6ea 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1236,7 +1236,7 @@ mod impls { impl PartialOrd for bool { #[inline] fn partial_cmp(&self, other: &bool) -> Option { - (*self as u8).partial_cmp(&(*other as u8)) + Some(self.cmp(other)) } }