aboutsummaryrefslogtreecommitdiff
path: root/src/transform.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transform.rs')
-rw-r--r--src/transform.rs14
1 files changed, 7 insertions, 7 deletions
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));
}
}