summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall/src/phase/mod.rs5
-rw-r--r--dhall/src/phase/typecheck.rs2
-rw-r--r--dhall/src/tests.rs3
-rw-r--r--dhall_syntax/src/core/expr.rs2
-rw-r--r--dhall_syntax/src/core/import.rs2
-rw-r--r--dhall_syntax/src/parser.rs6
-rw-r--r--serde_dhall/src/serde.rs32
7 files changed, 28 insertions, 24 deletions
diff --git a/dhall/src/phase/mod.rs b/dhall/src/phase/mod.rs
index ed608df..bd8853a 100644
--- a/dhall/src/phase/mod.rs
+++ b/dhall/src/phase/mod.rs
@@ -221,9 +221,8 @@ impl std::hash::Hash for Normalized {
where
H: std::hash::Hasher,
{
- match self.encode() {
- Ok(vec) => vec.hash(state),
- Err(_) => {}
+ if let Ok(vec) = self.encode() {
+ vec.hash(state)
}
}
}
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs
index ef2018a..ab6d882 100644
--- a/dhall/src/phase/typecheck.rs
+++ b/dhall/src/phase/typecheck.rs
@@ -408,7 +408,7 @@ fn type_last_layer(
RetTypeOnly(t.clone())
}
BoolIf(x, y, z) => {
- if &*x.get_type()?.as_whnf() != &ValueF::from_builtin(Bool) {
+ if *x.get_type()?.as_whnf() != ValueF::from_builtin(Bool) {
return mkerr(InvalidPredicate(x.clone()));
}
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 074818a..3055717 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -64,7 +64,7 @@ pub enum Status {
Failure,
}
-fn parse_file_str<'i>(file_path: &str) -> Result<Parsed> {
+fn parse_file_str(file_path: &str) -> Result<Parsed> {
Parsed::parse_file(&PathBuf::from(file_path))
}
@@ -80,6 +80,7 @@ pub fn run_test_stringy_error(
.map(|_| ())
}
+#[allow(clippy::single_match)]
pub fn run_test(
base_path: &str,
feature: Feature,
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index efbcee2..32166a6 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -331,7 +331,7 @@ impl<E> Expr<E> {
ExprF::BinOp(BinOp::ImportAlt, l, r) => l
.as_ref()
.traverse_resolve_with_visitor(visitor)
- .or(r.as_ref().traverse_resolve_with_visitor(visitor)),
+ .or_else(|_| r.as_ref().traverse_resolve_with_visitor(visitor)),
_ => {
let e = self.visit(&mut *visitor)?;
Ok(match &e {
diff --git a/dhall_syntax/src/core/import.rs b/dhall_syntax/src/core/import.rs
index 9329d48..d1f3fca 100644
--- a/dhall_syntax/src/core/import.rs
+++ b/dhall_syntax/src/core/import.rs
@@ -79,7 +79,7 @@ impl<SE> ImportLocation<SE> {
) -> Result<ImportLocation<SE2>, Err> {
use ImportLocation::*;
Ok(match self {
- Local(prefix, path) => Local(prefix.clone(), path.clone()),
+ Local(prefix, path) => Local(*prefix, path.clone()),
Remote(url) => Remote(url.visit_subexpr(f)?),
Env(env) => Env(env.clone()),
Missing => Missing,
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index 4da1dfc..d631a19 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -349,7 +349,7 @@ macro_rules! make_parser {
impl Parsers {
$(
- #[allow(non_snake_case, unused_variables)]
+ #[allow(non_snake_case, unused_variables, clippy::let_unit_value)]
fn $name<'a>(
(climbers, input): (&HashMap<Rule, PrecClimber<Rule>>, Rc<str>),
pair: Pair<'a, Rule>,
@@ -508,7 +508,7 @@ make_parser! {
0xAFFFE..=0xAFFFF | 0xBFFFE..=0xBFFFF |
0xCFFFE..=0xCFFFF | 0xDFFFE..=0xDFFFF |
0xEFFFE..=0xEFFFF | 0xFFFFE..=0xFFFFF |
- 0x10FFFE..=0x10FFFF => {
+ 0x10_FFFE..=0x10_FFFF => {
let c_ecapsed = c.escape_unicode();
Err(format!("Escape sequences can't contain non-characters: \"{}\"", c_ecapsed))?
},
@@ -1064,7 +1064,7 @@ make_parser! {
));
rule!(final_expression<ParsedSubExpr>; children!(
- [expression(e), EOI(_eoi)] => e
+ [expression(e), EOI(_)] => e
));
}
diff --git a/serde_dhall/src/serde.rs b/serde_dhall/src/serde.rs
index d891127..94b7e6c 100644
--- a/serde_dhall/src/serde.rs
+++ b/serde_dhall/src/serde.rs
@@ -33,20 +33,24 @@ impl<'de: 'a, 'a> serde::Deserializer<'de> for Deserializer<'a> {
use std::convert::TryInto;
use ExprF::*;
match self.0.as_ref().as_ref() {
- NaturalLit(n) => match (*n).try_into() {
- Ok(n64) => visitor.visit_u64(n64),
- Err(_) => match (*n).try_into() {
- Ok(n32) => visitor.visit_u32(n32),
- Err(_) => unimplemented!(),
- },
- },
- IntegerLit(n) => match (*n).try_into() {
- Ok(n64) => visitor.visit_i64(n64),
- Err(_) => match (*n).try_into() {
- Ok(n32) => visitor.visit_i32(n32),
- Err(_) => unimplemented!(),
- },
- },
+ NaturalLit(n) => {
+ if let Ok(n64) = (*n).try_into() {
+ visitor.visit_u64(n64)
+ } else if let Ok(n32) = (*n).try_into() {
+ visitor.visit_u32(n32)
+ } else {
+ unimplemented!()
+ }
+ }
+ IntegerLit(n) => {
+ if let Ok(n64) = (*n).try_into() {
+ visitor.visit_i64(n64)
+ } else if let Ok(n32) = (*n).try_into() {
+ visitor.visit_i32(n32)
+ } else {
+ unimplemented!()
+ }
+ }
RecordLit(m) => visitor.visit_map(
serde::de::value::MapDeserializer::new(m.iter().map(
|(k, v)| (k.as_ref(), Deserializer(Cow::Borrowed(v))),