aboutsummaryrefslogtreecommitdiff
path: root/src/syn_utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syn_utils.rs')
-rw-r--r--src/syn_utils.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/syn_utils.rs b/src/syn_utils.rs
index 00efee0..369aeb7 100644
--- a/src/syn_utils.rs
+++ b/src/syn_utils.rs
@@ -32,11 +32,6 @@ pub fn type_arguments_mut<P>(
})
}
-pub enum TypeOrPath<'a> {
- Type(&'a Type),
- Path(&'a Path),
-}
-
enum IterTypes<A, B, C, D, E, F> {
Single(A),
Function(B),
@@ -71,13 +66,13 @@ where
}
}
-pub fn iter_path(path: &Path) -> impl Iterator<Item = TypeOrPath> {
- iter::once(TypeOrPath::Path(path)).chain(types_in_path(path).flat_map(|t| iter_type(t)))
+pub fn iter_path(path: &Path) -> impl Iterator<Item = &Type> {
+ types_in_path(path).flat_map(|t| iter_type(t))
}
-pub fn iter_type<'a>(t: &'a Type) -> Box<dyn Iterator<Item = TypeOrPath<'a>> + 'a> {
+pub fn iter_type<'a>(t: &'a Type) -> Box<dyn Iterator<Item = &'a Type> + 'a> {
Box::new(
- iter::once(TypeOrPath::Type(t)).chain(match t {
+ iter::once(t).chain(match t {
Type::Array(array) => IterTypes::Single(iter_type(&array.elem)),
Type::Group(group) => IterTypes::Single(iter_type(&group.elem)),
Type::Paren(paren) => IterTypes::Single(iter_type(&paren.elem)),