aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parse_trait_sig.rs4
-rw-r--r--src/transform.rs14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/parse_trait_sig.rs b/src/parse_trait_sig.rs
index 825c425..aff4fe9 100644
--- a/src/parse_trait_sig.rs
+++ b/src/parse_trait_sig.rs
@@ -72,10 +72,10 @@ 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::AssocTypeWithoutDestType(span)) => {
+ Err((span, TransformError::AssocTypeWithoutDestType)) => {
return Err((span, MethodError::AssocTypeWithoutDestType));
}
- Err(TransformError::UnsupportedType(span)) => {
+ Err((span, TransformError::UnsupportedType)) => {
return Err((span, MethodError::UnsupportedType));
}
},
diff --git a/src/transform.rs b/src/transform.rs
index 7fd3672..13cf519 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -20,8 +20,8 @@ pub struct TypeConverter<'a> {
}
pub enum TransformError {
- AssocTypeWithoutDestType(Span),
- UnsupportedType(Span),
+ AssocTypeWithoutDestType,
+ UnsupportedType,
}
impl TypeConverter<'_> {
@@ -44,7 +44,7 @@ impl TypeConverter<'_> {
ident == "HashMap" || ident == "BTreeMap"
}
- pub fn convert_type(&self, type_: &mut Type) -> Result<TypeTransform, TransformError> {
+ pub fn convert_type(&self, type_: &mut Type) -> Result<TypeTransform, (Span, TransformError)> {
if !iter_type(type_).any(match_assoc_type) {
return Ok(TypeTransform::NoOp);
}
@@ -101,7 +101,7 @@ impl TypeConverter<'_> {
let dest_type = self
.assoc_type_conversions
.get(ident)
- .ok_or_else(|| TransformError::AssocTypeWithoutDestType(ident.span()))?;
+ .ok_or_else(|| (ident.span(), TransformError::AssocTypeWithoutDestType))?;
*type_ = dest_type.get_dest();
return Ok(dest_type.type_transformation());
}
@@ -154,7 +154,7 @@ impl TypeConverter<'_> {
// the type contains an associated type but we
// don't know how to deal with it so we abort
- Err(TransformError::UnsupportedType(type_.span()))
+ Err((type_.span(), TransformError::UnsupportedType))
}
}
@@ -237,10 +237,10 @@ fn dynamize_trait_bound(
Ok(ret_type) => {
transforms.push(ret_type);
}
- Err(TransformError::AssocTypeWithoutDestType(span)) => {
+ Err((span, TransformError::AssocTypeWithoutDestType)) => {
return Err((span, MethodError::AssocTypeWithoutDestType));
}
- Err(TransformError::UnsupportedType(span)) => {
+ Err((span, TransformError::UnsupportedType)) => {
return Err((span, MethodError::UnsupportedType));
}
}