diff --git a/pyo3-macros-backend/src/method.rs b/pyo3-macros-backend/src/method.rs index 1a46d333..31dfb075 100644 --- a/pyo3-macros-backend/src/method.rs +++ b/pyo3-macros-backend/src/method.rs @@ -269,7 +269,6 @@ pub struct FnSpec<'a> { // r# can be removed by syn::ext::IdentExt::unraw() pub python_name: syn::Ident, pub signature: FunctionSignature<'a>, - pub output: syn::Type, pub convention: CallingConvention, pub text_signature: Option, pub asyncness: Option, @@ -277,13 +276,6 @@ pub struct FnSpec<'a> { pub deprecations: Deprecations<'a>, } -pub fn get_return_info(output: &syn::ReturnType) -> syn::Type { - match output { - syn::ReturnType::Default => syn::Type::Infer(syn::parse_quote! {_}), - syn::ReturnType::Type(_, ty) => *ty.clone(), - } -} - pub fn parse_method_receiver(arg: &syn::FnArg) -> Result { match arg { syn::FnArg::Receiver( @@ -329,7 +321,6 @@ impl<'a> FnSpec<'a> { ensure_signatures_on_valid_method(&fn_type, signature.as_ref(), text_signature.as_ref())?; let name = &sig.ident; - let ty = get_return_info(&sig.output); let python_name = python_name.as_ref().unwrap_or(name).unraw(); let arguments: Vec<_> = sig @@ -361,7 +352,6 @@ impl<'a> FnSpec<'a> { convention, python_name, signature, - output: ty, text_signature, asyncness: sig.asyncness, unsafety: sig.unsafety, diff --git a/pyo3-macros-backend/src/pyclass.rs b/pyo3-macros-backend/src/pyclass.rs index 88cf9149..cf8d9aae 100644 --- a/pyo3-macros-backend/src/pyclass.rs +++ b/pyo3-macros-backend/src/pyclass.rs @@ -975,13 +975,8 @@ fn impl_complex_enum_struct_variant_cls( let field_type = field.ty; let field_with_type = quote! { #field_name: #field_type }; - let field_getter = complex_enum_variant_field_getter( - &variant_cls_type, - field_name, - field_type, - field.span, - ctx, - )?; + let field_getter = + complex_enum_variant_field_getter(&variant_cls_type, field_name, field.span, ctx)?; let field_getter_impl = quote! { fn #field_name(slf: #pyo3_path::PyRef) -> #pyo3_path::PyResult<#field_type> { @@ -1188,7 +1183,6 @@ fn complex_enum_struct_variant_new<'a>( name: &format_ident!("__pymethod_constructor__"), python_name: format_ident!("__new__"), signature, - output: variant_cls_type.clone(), convention: crate::method::CallingConvention::TpNew, text_signature: None, asyncness: None, @@ -1202,7 +1196,6 @@ fn complex_enum_struct_variant_new<'a>( fn complex_enum_variant_field_getter<'a>( variant_cls_type: &'a syn::Type, field_name: &'a syn::Ident, - field_type: &'a syn::Type, field_span: Span, ctx: &Ctx, ) -> Result { @@ -1215,7 +1208,6 @@ fn complex_enum_variant_field_getter<'a>( name: field_name, python_name: field_name.clone(), signature, - output: field_type.clone(), convention: crate::method::CallingConvention::Noargs, text_signature: None, asyncness: None, diff --git a/pyo3-macros-backend/src/pyfunction.rs b/pyo3-macros-backend/src/pyfunction.rs index 25d2536e..9f9557a3 100644 --- a/pyo3-macros-backend/src/pyfunction.rs +++ b/pyo3-macros-backend/src/pyfunction.rs @@ -240,15 +240,12 @@ pub fn impl_wrap_pyfunction( FunctionSignature::from_arguments(arguments)? }; - let ty = method::get_return_info(&func.sig.output); - let spec = method::FnSpec { tp, name: &func.sig.ident, convention: CallingConvention::from_signature(&signature), python_name, signature, - output: ty, text_signature, asyncness: func.sig.asyncness, unsafety: func.sig.unsafety,