Skip to content

Commit

Permalink
fix clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mkovaxx committed Nov 22, 2023
1 parent fdb4dc6 commit 44f201d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ enum PyClassEnum<'a> {

impl<'a> PyClassEnum<'a> {
fn new(enum_: &'a mut syn::ItemEnum) -> syn::Result<Self> {
let has_only_unit_variants = enum_.variants.iter().all(|variant| match variant.fields {
syn::Fields::Unit => true,
_ => false,
});
let has_only_unit_variants = enum_
.variants
.iter()
.all(|variant| matches!(variant.fields, syn::Fields::Unit));

Ok(if has_only_unit_variants {
let simple_enum = PyClassSimpleEnum::new(enum_)?;
Expand Down Expand Up @@ -871,7 +871,7 @@ fn impl_complex_enum(

let variant_new = complex_enum_variant_new(cls, variant)?;

let (variant_cls_impl, field_getters) = impl_complex_enum_variant_cls(cls, &variant)?;
let (variant_cls_impl, field_getters) = impl_complex_enum_variant_cls(cls, variant)?;
variant_cls_impls.push(variant_cls_impl);

let pyclass_impl = PyClassImplsBuilder::new(
Expand Down Expand Up @@ -914,7 +914,7 @@ fn impl_complex_enum_variant_cls(
variant: &PyClassComplexEnumVariant<'_>,
) -> Result<(TokenStream, Vec<MethodAndMethodDef>)> {
let variant_ident = &variant.ident;
let variant_cls = gen_complex_enum_variant_class_ident(enum_name, &variant.ident);
let variant_cls = gen_complex_enum_variant_class_ident(enum_name, variant.ident);
let variant_cls_type = parse_quote!(#variant_cls);

let mut field_names: Vec<Ident> = vec![];
Expand All @@ -928,7 +928,7 @@ fn impl_complex_enum_variant_cls(

let field_getter = complex_enum_variant_field_getter(
&variant_cls_type,
&field_name,
field_name,
field_type,
field.span,
)?;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ fn complex_enum_default_methods<'a>(
variant_names
.into_iter()
.map(|(var, py_name)| {
gen_complex_enum_variant_attr(&cls, &cls_type, &variant_to_attribute(var, &py_name))
gen_complex_enum_variant_attr(cls, &cls_type, &variant_to_attribute(var, &py_name))
})
.collect()
}
Expand Down Expand Up @@ -1137,7 +1137,7 @@ fn complex_enum_variant_field_getter<'a>(

let spec = FnSpec {
tp: crate::method::FnType::Getter(self_type.clone()),
name: &field_name,
name: field_name,
python_name: field_name.clone(),
signature,
output: field_type.clone(),
Expand All @@ -1153,7 +1153,7 @@ fn complex_enum_variant_field_getter<'a>(
doc: crate::get_doc(&[], None),
};

let getter = crate::pymethod::impl_py_getter_def(&variant_cls_type, property_type)?;
let getter = crate::pymethod::impl_py_getter_def(variant_cls_type, property_type)?;
Ok(getter)
}

Expand Down

0 comments on commit 44f201d

Please sign in to comment.