From c22e161f7bd97d4f6c063513cc051f6af2683d84 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 17 Mar 2020 23:01:35 +0000 Subject: Run clippy --- dhall/src/semantics/tck/env.rs | 12 ++++++------ dhall/src/semantics/tck/typecheck.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'dhall/src/semantics/tck') diff --git a/dhall/src/semantics/tck/env.rs b/dhall/src/semantics/tck/env.rs index 17b3cfe..6dd5076 100644 --- a/dhall/src/semantics/tck/env.rs +++ b/dhall/src/semantics/tck/env.rs @@ -21,18 +21,18 @@ impl VarEnv { pub fn from_size(size: usize) -> Self { VarEnv { size } } - pub fn size(&self) -> usize { + pub fn size(self) -> usize { self.size } - pub fn insert(&self) -> Self { + pub fn insert(self) -> Self { VarEnv { size: self.size + 1, } } - pub fn lookup(&self, var: &NzVar) -> AlphaVar { + pub fn lookup(self, var: NzVar) -> AlphaVar { self.lookup_fallible(var).unwrap() } - pub fn lookup_fallible(&self, var: &NzVar) -> Option { + pub fn lookup_fallible(self, var: NzVar) -> Option { let idx = self.size.checked_sub(var.idx() + 1)?; Some(AlphaVar::new(idx)) } @@ -67,8 +67,8 @@ impl TyEnv { items: self.items.insert_value(e, ty), } } - pub fn lookup(&self, var: &AlphaVar) -> Type { - self.items.lookup_ty(&var) + pub fn lookup(&self, var: AlphaVar) -> Type { + self.items.lookup_ty(var) } } diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs index 319bb9d..365df25 100644 --- a/dhall/src/semantics/tck/typecheck.rs +++ b/dhall/src/semantics/tck/typecheck.rs @@ -712,7 +712,7 @@ pub(crate) fn type_with<'hir>( annot: Option, ) -> Result, TypeError> { let tir = match hir.kind() { - HirKind::Var(var) => Tir::from_hir(hir, env.lookup(var)), + HirKind::Var(var) => Tir::from_hir(hir, env.lookup(*var)), HirKind::Import(_, ty) => Tir::from_hir(hir, ty.clone()), HirKind::Expr(ExprKind::Var(_)) => { unreachable!("Hir should contain no unresolved variables") -- cgit v1.2.3