diff options
author | Nadrieril | 2019-04-14 23:39:19 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-14 23:39:19 +0200 |
commit | 4c840270cf69f9580b18c43736bd247cab74e896 (patch) | |
tree | daff82a16a54f30309b79e29782017732ae2b9fc /dhall/src/typecheck.rs | |
parent | 2cf1fcbafce4cb27c08d16cc5b8c5943299ed707 (diff) |
clippy
Diffstat (limited to 'dhall/src/typecheck.rs')
-rw-r--r-- | dhall/src/typecheck.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index 8bc1cdd..b8f2d86 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -32,11 +32,10 @@ impl<'a> Resolved<'a> { } impl<'a> Typed<'a> { fn get_type_move(self) -> Result<Type<'static>, TypeError> { - self.1.ok_or(TypeError::new( - &Context::new(), - self.0, - TypeMessage::Untyped, - )) + let (expr, ty) = (self.0, self.1); + ty.ok_or_else(|| { + TypeError::new(&Context::new(), expr, TypeMessage::Untyped) + }) } } impl<'a> Normalized<'a> { @@ -128,10 +127,10 @@ fn match_vars(vl: &V<Label>, vr: &V<Label>, ctx: &[(&Label, &Label)]) -> bool { (0, 0) if xL == xL2 && xR == xR2 => return true, (_, _) => { if xL == xL2 { - nL = nL - 1; + nL -= 1; } if xR == xR2 { - nR = nR - 1; + nR -= 1; } } } @@ -448,7 +447,7 @@ fn type_last_layer( f.into_expr(), args.into_iter() .take(i) - .map(|e| e.into_expr()) + .map(Typed::into_expr) .collect() )), Some(tf), @@ -464,7 +463,7 @@ fn type_last_layer( f.into_expr(), args.into_iter() .take(i + 1) - .map(|e| e.into_expr()) + .map(Typed::into_expr) .collect(), )), Some(tf), |