summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-04-14 23:39:19 +0200
committerNadrieril2019-04-14 23:39:19 +0200
commit4c840270cf69f9580b18c43736bd247cab74e896 (patch)
treedaff82a16a54f30309b79e29782017732ae2b9fc /dhall
parent2cf1fcbafce4cb27c08d16cc5b8c5943299ed707 (diff)
clippy
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/imports.rs6
-rw-r--r--dhall/src/lib.rs3
-rw-r--r--dhall/src/normalize.rs2
-rw-r--r--dhall/src/tests.rs4
-rw-r--r--dhall/src/typecheck.rs17
5 files changed, 15 insertions, 17 deletions
diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs
index 2dce39d..20affc4 100644
--- a/dhall/src/imports.rs
+++ b/dhall/src/imports.rs
@@ -76,9 +76,9 @@ fn do_resolve_expr<'a>(
Ok(Resolved(rc(expr)))
}
-fn skip_resolve_expr<'a>(
- Parsed(expr, _root): Parsed<'a>,
-) -> Result<Resolved<'a>, ImportError> {
+fn skip_resolve_expr(
+ Parsed(expr, _root): Parsed<'_>,
+) -> Result<Resolved<'_>, ImportError> {
let resolve =
|import: &Import| -> Result<Normalized<'static>, ImportError> {
Err(ImportError::UnexpectedImport(import.clone()))
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index 91e3f6a..37686e9 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -7,7 +7,8 @@
#![allow(
clippy::type_complexity,
clippy::infallible_destructuring_match,
- clippy::many_single_char_names
+ clippy::many_single_char_names,
+ clippy::match_wild_err_arm
)]
//! [Dhall][dhall] is a programmable configuration language that provides a non-repetitive
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index debf277..716b7ee 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -313,7 +313,7 @@ fn normalize_ref(expr: &Expr<X, Normalized<'static>>) -> Expr<X, X> {
DoneRefSub(e) => e.unroll(),
DoneAsIs => match expr.map_ref_simple(ExprF::roll) {
e => e.map_ref(
- |e| e.clone(),
+ SubExpr::clone,
|_, e| e.clone(),
X::clone,
|_| unreachable!(),
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 4a69050..bb61776 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -158,9 +158,7 @@ pub fn run_test(
}
}
Import => {
- parse_file_str(&file_path)?
- .resolve()
- .unwrap_err();
+ parse_file_str(&file_path)?.resolve().unwrap_err();
}
Normalization => unreachable!(),
Typecheck | TypeInference => {
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),