summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-04-14 23:39:19 +0200
committerNadrieril2019-04-14 23:39:19 +0200
commit4c840270cf69f9580b18c43736bd247cab74e896 (patch)
treedaff82a16a54f30309b79e29782017732ae2b9fc
parent2cf1fcbafce4cb27c08d16cc5b8c5943299ed707 (diff)
clippy
-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
-rw-r--r--dhall_core/src/parser.rs2
-rw-r--r--dhall_core/src/visitor.rs4
7 files changed, 18 insertions, 20 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),
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs
index cae6cbd..cea7cea 100644
--- a/dhall_core/src/parser.rs
+++ b/dhall_core/src/parser.rs
@@ -26,7 +26,7 @@ pub type ParseError = pest::error::Error<Rule>;
pub type ParseResult<T> = Result<T, ParseError>;
-fn rc<'a>(x: ParsedExpr<'a>) -> ParsedSubExpr<'a> {
+fn rc(x: ParsedExpr<'_>) -> ParsedSubExpr<'_> {
crate::rc(x)
}
diff --git a/dhall_core/src/visitor.rs b/dhall_core/src/visitor.rs
index 3efd920..b0424ac 100644
--- a/dhall_core/src/visitor.rs
+++ b/dhall_core/src/visitor.rs
@@ -79,7 +79,7 @@ where
input: &'a ExprF<SE1, L1, N1, E1>,
) -> Result<ExprF<SE2, L2, N2, E2>, T::Error> {
fn vec<'a, T, U, Err, F: FnMut(&'a T) -> Result<U, Err>>(
- x: &'a Vec<T>,
+ x: &'a [T],
f: F,
) -> Result<Vec<U>, Err> {
x.iter().map(f).collect()
@@ -102,7 +102,7 @@ where
L2: Ord,
V: ExprFFallibleVisitor<'a, SE, SE2, L, L2, N, N2, E, E2>,
{
- x.into_iter()
+ x.iter()
.map(|(k, x)| Ok((v.visit_label(k)?, v.visit_subexpr(x)?)))
.collect()
}