Skip to content

Commit eb9ea66

Browse files
authored
Merge pull request #43 from nnethercote/rm-VarValue-methods
Remove `VarValue::{parent,if_not_self}`.
2 parents 8c8f9ef + 53e692b commit eb9ea66

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

src/unify/mod.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,8 @@ impl<K: UnifyKey> VarValue<K> {
230230
self.rank = rank;
231231
self.value = value;
232232
}
233-
234-
fn parent(&self, self_key: K) -> Option<K> {
235-
self.if_not_self(self.parent, self_key)
236-
}
237-
238-
fn if_not_self(&self, key: K, self_key: K) -> Option<K> {
239-
if key == self_key {
240-
None
241-
} else {
242-
Some(key)
243-
}
244-
}
245233
}
234+
246235
impl<K> UnificationTableStorage<K>
247236
where
248237
K: UnifyKey,
@@ -358,13 +347,12 @@ impl<S: UnificationStoreMut> UnificationTable<S> {
358347
/// callsites. `uninlined_get_root_key` is the never-inlined version.
359348
#[inline(always)]
360349
fn inlined_get_root_key(&mut self, vid: S::Key) -> S::Key {
361-
let redirect = {
362-
match self.value(vid).parent(vid) {
363-
None => return vid,
364-
Some(redirect) => redirect,
365-
}
366-
};
350+
let v = self.value(vid);
351+
if v.parent == vid {
352+
return vid;
353+
}
367354

355+
let redirect = v.parent;
368356
let root_key: S::Key = self.uninlined_get_root_key(redirect);
369357
if root_key != redirect {
370358
// Path compression

0 commit comments

Comments
 (0)