aboutsummaryrefslogtreecommitdiff
path: root/src/parse_assoc_type.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-20 15:10:23 +0100
committerMartin Fischer <martin@push-f.com>2021-11-20 18:36:07 +0100
commit91ca29ade1ab6b90dda972c2a42a5dc529ddfb44 (patch)
treeaec288a5858fe3e8a90f0357c69571e091cf85d6 /src/parse_assoc_type.rs
parente918eb0ab2cf6d84751f5f52b49414d382b7abbb (diff)
refactor: traverse AST via iterators
Diffstat (limited to 'src/parse_assoc_type.rs')
-rw-r--r--src/parse_assoc_type.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse_assoc_type.rs b/src/parse_assoc_type.rs
index 7efc7da..85f3723 100644
--- a/src/parse_assoc_type.rs
+++ b/src/parse_assoc_type.rs
@@ -3,9 +3,9 @@ use quote::{quote, ToTokens};
use syn::spanned::Spanned;
use syn::{GenericArgument, Ident, Path, PathArguments, PathSegment, TraitItemType, Type};
+use crate::match_assoc_type;
use crate::parse_trait_sig::TypeTransform;
-use crate::syn_utils::{find_in_type, lifetime_bounds, trait_bounds};
-use crate::AssocTypeMatcher;
+use crate::syn_utils::{iter_type, lifetime_bounds, trait_bounds};
#[derive(Debug)]
pub enum AssocTypeParseError {
@@ -63,7 +63,7 @@ pub fn parse_assoc_type(
if ident == "Into" && args.args.len() == 1 {
if let GenericArgument::Type(into_type) = args.args.first().unwrap() {
// provide a better error message for type A: Into<Self::B>
- if find_in_type(into_type, &AssocTypeMatcher).is_some() {
+ if iter_type(into_type).any(match_assoc_type) {
return Err((into_type.span(), AssocTypeParseError::AssocTypeInBound));
}