perf: a small optimization to signed_integer equality checks

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-10-22 14:56:58 +02:00
parent 4ccc9c31db
commit f9e6b3caa8

View File

@ -53,7 +53,8 @@ macro_rules! eq_gadget_impl {
impl PartialEq for $gadget {
fn eq(&self, other: &Self) -> bool {
!self.value.is_none() && !other.value.is_none() && self.value == other.value
// self.value == other.value means that other.value.is_some() too
self.value.is_some() && self.value == other.value
}
}