diff options
Diffstat (limited to 'src/parse_trait_sig.rs')
-rw-r--r-- | src/parse_trait_sig.rs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/parse_trait_sig.rs b/src/parse_trait_sig.rs index 9542a69..825c425 100644 --- a/src/parse_trait_sig.rs +++ b/src/parse_trait_sig.rs @@ -27,11 +27,12 @@ pub enum MethodError { NonDispatchableMethod, AssocTypeInInputs, ImplTraitInInputs, - AssocTypeInUnsupportedReturnType, - UnconvertibleAssocTypeInFnInput, - UnconvertibleAssocTypeInTraitBound, - UnconvertibleAssocTypeInWhereClause, - UnconvertibleAssocType, + + // TODO: wrap TransformError + AssocTypeWithoutDestType, + UnsupportedType, + + UnconvertedAssocType, } fn filter_map_impl_trait(item: TypeOrPath) -> Option<&TypeImplTrait> { @@ -71,11 +72,11 @@ pub fn parse_trait_signature( let return_type = match &mut signature.output { ReturnType::Type(_, og_type) => match type_converter.convert_type(og_type) { Ok(ret_type) => ret_type, - Err(TransformError::UnconvertibleAssocType(span)) => { - return Err((span, MethodError::UnconvertibleAssocType)); + Err(TransformError::AssocTypeWithoutDestType(span)) => { + return Err((span, MethodError::AssocTypeWithoutDestType)); } - Err(TransformError::AssocTypeInUnsupportedType(span)) => { - return Err((span, MethodError::AssocTypeInUnsupportedReturnType)); + Err(TransformError::UnsupportedType(span)) => { + return Err((span, MethodError::UnsupportedType)); } }, ReturnType::Default => TypeTransform::NoOp, @@ -193,7 +194,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::UnconvertibleAssocType)) + Err((_, MethodError::AssocTypeWithoutDestType)) )); } @@ -258,7 +259,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::AssocTypeInUnsupportedReturnType)) + Err((_, MethodError::UnsupportedType)) )); } @@ -271,7 +272,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::AssocTypeInUnsupportedReturnType)) + Err((_, MethodError::UnsupportedType)) )); } @@ -284,7 +285,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::AssocTypeInUnsupportedReturnType)) + Err((_, MethodError::UnsupportedType)) )); } @@ -297,7 +298,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::AssocTypeInUnsupportedReturnType)) + Err((_, MethodError::UnsupportedType)) )); } @@ -349,7 +350,7 @@ mod tests { assert!(matches!( parse_trait_signature(&mut type1.sig, &Default::default()), - Err((_, MethodError::UnconvertibleAssocTypeInFnInput)) + Err((_, MethodError::UnsupportedType)) )); } } |