diff --git a/rearch-effects/src/overridable_capsule.rs b/rearch-effects/src/overridable_capsule.rs index 695d7a9..ecc04ec 100644 --- a/rearch-effects/src/overridable_capsule.rs +++ b/rearch-effects/src/overridable_capsule.rs @@ -211,10 +211,7 @@ mod dyn_capsule_key { } fn dyn_eq(&self, other: &dyn DynCapsuleKey) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |other| self == other) + other.as_any().downcast_ref::() == Some(self) } } impl Hash for dyn DynCapsuleKey { diff --git a/rearch/src/capsule_key.rs b/rearch/src/capsule_key.rs index 28a1f39..0553889 100644 --- a/rearch/src/capsule_key.rs +++ b/rearch/src/capsule_key.rs @@ -29,10 +29,7 @@ where } fn dyn_eq(&self, other: &dyn DynCapsuleKey) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |other| self == other) + other.as_any().downcast_ref::() == Some(self) } } impl Hash for dyn DynCapsuleKey { diff --git a/rearch/src/lib.rs b/rearch/src/lib.rs index 1781f45..c85ef94 100644 --- a/rearch/src/lib.rs +++ b/rearch/src/lib.rs @@ -480,7 +480,7 @@ impl CapsuleManager { .remove(&id) .as_ref() .map(downcast_capsule_data::) - .map_or(true, |old_data| !C::eq(old_data, &new_data)); + .is_none_or(|old_data| !C::eq(old_data, &new_data)); txn.data.insert(id, Box::new(new_data));