Skip to content

Commit

Permalink
Fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Jun 15, 2024
1 parent 16fd093 commit 4c1f8bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ impl<'a, 'b> State<'a, 'b> {
if fields_type_params.contains_key(arg) {
bounds
.entry(fields_type_params[arg].clone())
.or_insert_with(HashSet::default)
.or_default()
.insert(trait_name_to_trait_bound(pl.trait_name));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn render_enum(
backtrace_match_arms.push(expr);
}

bounds.extend(parsed_fields.bounds.into_iter());
bounds.extend(parsed_fields.bounds);
}

let render = |match_arms: &mut Vec<TokenStream>| {
Expand Down
21 changes: 1 addition & 20 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ pub enum DeriveType {
pub struct State<'input> {
pub input: &'input DeriveInput,
pub trait_name: &'static str,
pub trait_ident: Ident,
pub method_ident: Ident,
pub trait_module: TokenStream,
pub trait_path: TokenStream,
Expand Down Expand Up @@ -535,7 +534,6 @@ impl<'input> State<'input> {
Ok(State {
input,
trait_name,
trait_ident,
method_ident,
trait_module,
trait_path,
Expand Down Expand Up @@ -595,7 +593,6 @@ impl<'input> State<'input> {
trait_path,
trait_path_params: vec![],
trait_attr,
trait_ident,
method_ident,
// input,
fields,
Expand Down Expand Up @@ -628,7 +625,6 @@ impl<'input> State<'input> {
field_type: data.field_types[0],
member: data.members[0].clone(),
info: data.infos[0].clone(),
field_ident: data.field_idents[0].clone(),
trait_path: data.trait_path,
trait_path_with_params: data.trait_path_with_params.clone(),
casted_trait: data.casted_traits[0].clone(),
Expand Down Expand Up @@ -701,17 +697,9 @@ impl<'input> State<'input> {
panic!("can only derive({}) for enum", self.trait_name)
}
let variants = self.enabled_variants();
let trait_path = &self.trait_path;
let (impl_generics, ty_generics, where_clause) = self.generics.split_for_impl();
MultiVariantData {
input_type: &self.input.ident,
variants,
variant_states: self.enabled_variant_states(),
infos: self.enabled_infos(),
trait_path,
impl_generics,
ty_generics,
where_clause,
}
}

Expand Down Expand Up @@ -793,7 +781,6 @@ pub struct SingleFieldData<'input, 'state> {
pub input_type: &'input Ident,
pub field: &'input Field,
pub field_type: &'input Type,
pub field_ident: TokenStream,
pub member: TokenStream,
pub info: FullMetaInfo,
pub trait_path: &'state TokenStream,
Expand Down Expand Up @@ -828,14 +815,8 @@ pub struct MultiFieldData<'input, 'state> {
}

pub struct MultiVariantData<'input, 'state> {
pub input_type: &'input Ident,
pub variants: Vec<&'input Variant>,
pub variant_states: Vec<&'state State<'input>>,
pub infos: Vec<FullMetaInfo>,
pub trait_path: &'state TokenStream,
pub impl_generics: ImplGenerics<'state>,
pub ty_generics: TypeGenerics<'state>,
pub where_clause: Option<&'state WhereClause>,
}

impl<'input, 'state> MultiFieldData<'input, 'state> {
Expand Down Expand Up @@ -1189,7 +1170,7 @@ pub fn get_if_type_parameter_used_in_type(
if is_type_parameter_used_in_type(type_parameters, ty) {
match ty {
syn::Type::Reference(syn::TypeReference { elem: ty, .. }) => {
Some((&**ty).clone())
Some((**ty).clone())
}
ty => Some(ty.clone()),
}
Expand Down

0 comments on commit 4c1f8bc

Please sign in to comment.