summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Brown <gmb60@cam.ac.uk>2021-01-16 12:19:50 +0000
committerGreg Brown <gmb60@cam.ac.uk>2021-01-16 12:45:24 +0000
commit795e7df2955c95d54445fd15d9dc37c6b290a068 (patch)
treeee2be2a7beb0bee09c3910d2f1a3c789e3e9ae54
parent601723aff0a881c9796173580c0c4d5b1b28df51 (diff)
Fix warnings in `lower`.
-rw-r--r--src/lower/mod.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lower/mod.rs b/src/lower/mod.rs
index 06099e3..aaa39ed 100644
--- a/src/lower/mod.rs
+++ b/src/lower/mod.rs
@@ -40,6 +40,8 @@ pub struct RustBackend {
context: Vec<usize>,
}
+type NamedSpan = (Option<Name>, Span);
+
impl RustBackend {
fn new_type_name(&mut self, prefix: &str, name: Option<Name>, span: Span) -> (usize, Ident) {
let id = self.data.len();
@@ -58,7 +60,7 @@ impl RustBackend {
fn recurse_exprs<I: IntoIterator<Item = TypedExpression>>(
&mut self,
iter: I,
- ) -> (Vec<Type>, Vec<(Option<Name>, Span)>, Vec<usize>) {
+ ) -> (Vec<Type>, Vec<NamedSpan>, Vec<usize>) {
let (ty_name_span, ids): (Vec<_>, _) = iter
.into_iter()
.map(|e| {
@@ -97,7 +99,7 @@ impl RustBackend {
iter.into_iter().map(move |id| self.data[id].name.clone())
}
- fn name_parts_snake<'a, I: 'a + IntoIterator<Item = (Option<Name>, Span)>>(
+ fn name_parts_snake<'a, I: 'a + IntoIterator<Item = NamedSpan>>(
default: &'a str,
iter: I,
) -> impl Iterator<Item = Ident> + '_ {
@@ -115,7 +117,7 @@ impl RustBackend {
})
}
- fn name_parts_camel<'a, I: 'a + IntoIterator<Item = (Option<Name>, Span)>>(
+ fn name_parts_camel<'a, I: 'a + IntoIterator<Item = NamedSpan>>(
default: &'a str,
iter: I,
) -> impl Iterator<Item = Ident> + '_ {
@@ -426,7 +428,7 @@ impl Backend for RustBackend {
id
}
- fn gen_variable(&mut self, name: Option<Name>, span: Option<Span>, var: Variable) -> Self::Id {
+ fn gen_variable(&mut self, _name: Option<Name>, span: Option<Span>, var: Variable) -> Self::Id {
let span = span.unwrap_or_else(Span::call_site);
let fix_id = self.context[self.context.len() - var.index() - 1];
@@ -436,7 +438,7 @@ impl Backend for RustBackend {
let id = self.data.len();
let fix_ty = self.data[fix_id].name.clone();
- let name = quote! {Box<#fix_ty>};
+ let name = quote_spanned! {span=> Box<#fix_ty>};
self.var_map.insert(fix_id, id);
self.data.push(Ty {
name,