mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 08:30:51 +00:00
use ptr::eq/hash for readability
This commit is contained in:
parent
76f153e35e
commit
a7a8309c95
1 changed files with 3 additions and 6 deletions
|
@ -2,6 +2,7 @@ use crate::runtime::Revision;
|
||||||
use crate::Database;
|
use crate::Database;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hasher;
|
use std::hash::Hasher;
|
||||||
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Unsafe proof obligations:
|
/// Unsafe proof obligations:
|
||||||
|
@ -31,10 +32,6 @@ impl<DB: Database> Dependency<DB> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn raw_slot(&self) -> *const dyn DatabaseSlot<DB> {
|
|
||||||
&*self.slot
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn maybe_changed_since(&self, db: &DB, revision: Revision) -> bool {
|
pub(crate) fn maybe_changed_since(&self, db: &DB, revision: Revision) -> bool {
|
||||||
self.slot.maybe_changed_since(db, revision)
|
self.slot.maybe_changed_since(db, revision)
|
||||||
}
|
}
|
||||||
|
@ -45,13 +42,13 @@ impl<DB: Database> std::hash::Hash for Dependency<DB> {
|
||||||
where
|
where
|
||||||
H: Hasher,
|
H: Hasher,
|
||||||
{
|
{
|
||||||
self.raw_slot().hash(state)
|
ptr::hash(&*self.slot, state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<DB: Database> std::cmp::PartialEq for Dependency<DB> {
|
impl<DB: Database> std::cmp::PartialEq for Dependency<DB> {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.raw_slot() == other.raw_slot()
|
ptr::eq(&*self.slot, &*other.slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue