From a7a8309c95a49c8aefd9b5d9ecdc8264aaded4dc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 3 Jul 2019 22:24:11 +0300 Subject: [PATCH] use ptr::eq/hash for readability --- src/dependency.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/dependency.rs b/src/dependency.rs index ab48c6dc..5fba2371 100644 --- a/src/dependency.rs +++ b/src/dependency.rs @@ -2,6 +2,7 @@ use crate::runtime::Revision; use crate::Database; use std::fmt::Debug; use std::hash::Hasher; +use std::ptr; use std::sync::Arc; /// Unsafe proof obligations: @@ -31,10 +32,6 @@ impl Dependency { } } - fn raw_slot(&self) -> *const dyn DatabaseSlot { - &*self.slot - } - pub(crate) fn maybe_changed_since(&self, db: &DB, revision: Revision) -> bool { self.slot.maybe_changed_since(db, revision) } @@ -45,13 +42,13 @@ impl std::hash::Hash for Dependency { where H: Hasher, { - self.raw_slot().hash(state) + ptr::hash(&*self.slot, state) } } impl std::cmp::PartialEq for Dependency { fn eq(&self, other: &Self) -> bool { - self.raw_slot() == other.raw_slot() + ptr::eq(&*self.slot, &*other.slot) } }