Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove dead code
  • Loading branch information
Icxolu committed Apr 2, 2024
commit 7c924e9b8bce5036348e73eadce0848f0499e645
22 changes: 2 additions & 20 deletions pyo3-macros-backend/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ pub struct RegularArg<'a> {
pub struct VarArg<'a> {
pub name: &'a syn::Ident,
pub ty: &'a syn::Type,
pub attrs: PyFunctionArgPyO3Attributes,
}

#[derive(Clone, Debug)]
pub struct KwArg<'a> {
pub name: &'a syn::Ident,
pub ty: &'a syn::Type,
pub attrs: PyFunctionArgPyO3Attributes,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -94,19 +92,11 @@ impl<'a> FnArg<'a> {
if let Self::Regular(RegularArg {
name,
ty,
attrs,
option_wrapped_type: None,
..
}) = self
{
let attrs = std::mem::replace(
attrs,
PyFunctionArgPyO3Attributes {
from_py_with: None,
cancel_handle: None,
},
);
*self = Self::VarArgs(VarArg { name, ty, attrs });
*self = Self::VarArgs(VarArg { name, ty });
Ok(self)
} else {
bail_spanned!(self.name().span() => "args cannot be optional")
Expand All @@ -117,19 +107,11 @@ impl<'a> FnArg<'a> {
if let Self::Regular(RegularArg {
name,
ty,
attrs,
option_wrapped_type: Some(..),
..
}) = self
{
let attrs = std::mem::replace(
attrs,
PyFunctionArgPyO3Attributes {
from_py_with: None,
cancel_handle: None,
},
);
*self = Self::KwArgs(KwArg { name, ty, attrs });
*self = Self::KwArgs(KwArg { name, ty });
Ok(self)
} else {
bail_spanned!(self.name().span() => "kwargs must be Option<_>")
Expand Down