Give inferred closure args their own type
diff --git a/src/expr.rs b/src/expr.rs
index 0b8f4ee..1344b07 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1580,16 +1580,15 @@
pat: syn!(Pat) >>
ty: option!(tuple!(punct!(:), syn!(Type))) >>
({
- let (colon, ty) = ty.unwrap_or_else(|| {
- (<Token![:]>::default(), TypeInfer {
- underscore_token: <Token![_]>::default(),
- }.into())
- });
- ArgCaptured {
- pat: pat,
- colon_token: colon,
- ty: ty,
- }.into()
+ if let Some((colon, ty)) = ty {
+ FnArg::Captured(ArgCaptured {
+ pat: pat,
+ colon_token: colon,
+ ty: ty,
+ })
+ } else {
+ FnArg::Inferred(pat)
+ }
})
));
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index c07f6bf..9b69bc3 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -1389,6 +1389,11 @@
_visitor.fold_arg_captured(_binding_0),
)
}
+ Inferred(_binding_0, ) => {
+ Inferred (
+ _visitor.fold_pat(_binding_0),
+ )
+ }
Ignored(_binding_0, ) => {
Ignored (
_visitor.fold_type(_binding_0),
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index cdfefe3..c560e34 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -1087,6 +1087,9 @@
Captured(ref _binding_0, ) => {
_visitor.visit_arg_captured(_binding_0);
}
+ Inferred(ref _binding_0, ) => {
+ _visitor.visit_pat(_binding_0);
+ }
Ignored(ref _binding_0, ) => {
_visitor.visit_type(_binding_0);
}
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index a6afbf9..1df357d 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -1087,6 +1087,9 @@
Captured(ref mut _binding_0, ) => {
_visitor.visit_arg_captured_mut(_binding_0);
}
+ Inferred(ref mut _binding_0, ) => {
+ _visitor.visit_pat_mut(_binding_0);
+ }
Ignored(ref mut _binding_0, ) => {
_visitor.visit_type_mut(_binding_0);
}
diff --git a/src/item.rs b/src/item.rs
index 6027065..97ba25b 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -468,6 +468,7 @@
pub colon_token: Token![:],
pub ty: Type,
}),
+ pub Inferred(Pat),
pub Ignored(Type),
}
}