remove some dead fields from FnArg

This commit is contained in:
David Hewitt 2023-07-11 19:59:12 +01:00
parent 39edeebf67
commit a5d97b3ad0

View file

@ -13,8 +13,6 @@ use syn::Result;
#[derive(Clone, Debug)]
pub struct FnArg<'a> {
pub name: &'a syn::Ident,
pub by_ref: &'a Option<syn::token::Ref>,
pub mutability: &'a Option<syn::token::Mut>,
pub ty: &'a syn::Type,
pub optional: Option<&'a syn::Type>,
pub default: Option<syn::Expr>,
@ -37,20 +35,13 @@ impl<'a> FnArg<'a> {
}
let arg_attrs = PyFunctionArgPyO3Attributes::from_attrs(&mut cap.attrs)?;
let (ident, by_ref, mutability) = match &*cap.pat {
syn::Pat::Ident(syn::PatIdent {
ident,
by_ref,
mutability,
..
}) => (ident, by_ref, mutability),
let ident = match &*cap.pat {
syn::Pat::Ident(syn::PatIdent { ident, .. }) => ident,
other => return Err(handle_argument_error(other)),
};
Ok(FnArg {
name: ident,
by_ref,
mutability,
ty: &cap.ty,
optional: utils::option_type_argument(&cap.ty),
default: None,