summaryrefslogtreecommitdiff
path: root/serde_dhall
diff options
context:
space:
mode:
authorNadrieril2019-08-27 22:58:20 +0200
committerNadrieril2019-08-27 22:58:57 +0200
commita981afc465f4279a7a4d6ce3ac5844e04846613b (patch)
treefb548f87f2c6e5be73d0fc44ca49f44b6de80dba /serde_dhall
parent7d11bebc8f2047bb5a26f7f52ae0bd1f60bb6367 (diff)
clippy
Diffstat (limited to 'serde_dhall')
-rw-r--r--serde_dhall/src/serde.rs32
1 files changed, 18 insertions, 14 deletions
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))),