summaryrefslogtreecommitdiff
path: root/dhall_generator
diff options
context:
space:
mode:
authorNadrieril2019-03-09 16:24:14 +0100
committerNadrieril2019-03-09 16:24:14 +0100
commitcb9dfc1b9421e9814dac3ba6c78bad0d271f9d67 (patch)
treefa1b6e14b16c7d63f6ad7df8ed583f24cbdad3c2 /dhall_generator
parent6037cb224c5e61828ba41cb3d34438ad03a71403 (diff)
Obey clippy lints
Closes #14
Diffstat (limited to 'dhall_generator')
-rw-r--r--dhall_generator/src/lib.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/dhall_generator/src/lib.rs b/dhall_generator/src/lib.rs
index 780b621..4be3fa0 100644
--- a/dhall_generator/src/lib.rs
+++ b/dhall_generator/src/lib.rs
@@ -40,11 +40,11 @@ fn dhall_to_tokenstream(
quote! { App(#f, #a) }
}
Builtin(b) => {
- let b = builtin_to_tokenstream(b);
+ let b = builtin_to_tokenstream(*b);
quote! { Builtin(#b) }
}
BinOp(o, a, b) => {
- let o = binop_to_tokenstream(o);
+ let o = binop_to_tokenstream(*o);
let a = dhall_to_tokenstream_bx(a, ctx);
let b = dhall_to_tokenstream_bx(b, ctx);
quote! { BinOp(#o, #a, #b) }
@@ -55,8 +55,7 @@ fn dhall_to_tokenstream(
.map(deref)
.map(|x| dhall_to_tokenstream_bx(x, ctx)),
);
- let es =
- vec_tks(es.into_iter().map(|x| dhall_to_tokenstream(x, ctx)));
+ let es = vec_tks(es.iter().map(|x| dhall_to_tokenstream(x, ctx)));
quote! { OptionalLit(#t, #es) }
}
ListLit(t, es) => {
@@ -65,8 +64,7 @@ fn dhall_to_tokenstream(
.map(deref)
.map(|x| dhall_to_tokenstream_bx(x, ctx)),
);
- let es =
- vec_tks(es.into_iter().map(|x| dhall_to_tokenstream(x, ctx)));
+ let es = vec_tks(es.iter().map(|x| dhall_to_tokenstream(x, ctx)));
quote! { ListLit(#t, #es) }
}
e => unimplemented!("{:?}", e),
@@ -103,14 +101,15 @@ fn dhall_to_tokenstream_bx(
}
}
-fn builtin_to_tokenstream(b: &Builtin) -> TokenStream {
+fn builtin_to_tokenstream(b: Builtin) -> TokenStream {
format!("{:?}", b).parse().unwrap()
}
-fn binop_to_tokenstream(b: &BinOp) -> TokenStream {
+fn binop_to_tokenstream(b: BinOp) -> TokenStream {
format!("{:?}", b).parse().unwrap()
}
+#[allow(clippy::borrowed_box)]
fn deref<T>(x: &Box<T>) -> &T {
&*x
}