diff --git a/src/unify/mod.rs b/src/unify/mod.rs index a26d699..5377177 100644 --- a/src/unify/mod.rs +++ b/src/unify/mod.rs @@ -230,19 +230,8 @@ impl VarValue { self.rank = rank; self.value = value; } - - fn parent(&self, self_key: K) -> Option { - self.if_not_self(self.parent, self_key) - } - - fn if_not_self(&self, key: K, self_key: K) -> Option { - if key == self_key { - None - } else { - Some(key) - } - } } + impl UnificationTableStorage where K: UnifyKey, @@ -358,13 +347,12 @@ impl UnificationTable { /// callsites. `uninlined_get_root_key` is the never-inlined version. #[inline(always)] fn inlined_get_root_key(&mut self, vid: S::Key) -> S::Key { - let redirect = { - match self.value(vid).parent(vid) { - None => return vid, - Some(redirect) => redirect, - } - }; + let v = self.value(vid); + if v.parent == vid { + return vid; + } + let redirect = v.parent; let root_key: S::Key = self.uninlined_get_root_key(redirect); if root_key != redirect { // Path compression