diff options
author | Nadrieril | 2020-01-29 21:35:28 +0000 |
---|---|---|
committer | Nadrieril | 2020-01-29 21:35:28 +0000 |
commit | 280b3174476ef8fe5a98f3614f4fe253fa243d8c (patch) | |
tree | 93062b08134200b703670b0fe91898a437a924d2 /dhall/src/syntax/ast | |
parent | 22bec94618454f57773716870f5624579ab712ce (diff) |
Finally get rid of all of the shift/subst_shift !
Diffstat (limited to '')
-rw-r--r-- | dhall/src/syntax/ast/expr.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs index 0da617b..424ac34 100644 --- a/dhall/src/syntax/ast/expr.rs +++ b/dhall/src/syntax/ast/expr.rs @@ -320,18 +320,6 @@ impl<E> Expr<E> { } } -impl<Label: PartialEq + Clone> V<Label> { - pub(crate) fn shift(&self, delta: isize, var: &V<Label>) -> Option<Self> { - let V(x, n) = var; - let V(y, m) = self; - Some(if x == y && n <= m { - V(y.clone(), add_ui(*m, delta)?) - } else { - V(y.clone(), *m) - }) - } -} - pub fn trivial_result<T>(x: Result<T, !>) -> T { match x { Ok(x) => x, @@ -339,16 +327,6 @@ pub fn trivial_result<T>(x: Result<T, !>) -> T { } } -/// Add an isize to an usize -/// Returns `None` on over/underflow -fn add_ui(u: usize, i: isize) -> Option<usize> { - Some(if i < 0 { - u.checked_sub(i.checked_neg()? as usize)? - } else { - u.checked_add(i as usize)? - }) -} - impl PartialEq for NaiveDouble { fn eq(&self, other: &Self) -> bool { self.0.to_bits() == other.0.to_bits() |