chore: enable clippy::trivially_copy_pass_by_ref lint and address it (#6724)

This commit is contained in:
Sanchith Hegde
2024-12-05 20:11:40 +05:30
committed by GitHub
parent e5dde6acc0
commit d17d2fe075
154 changed files with 423 additions and 429 deletions

View File

@ -124,7 +124,7 @@ enum StructType {
impl StructType {
/// Generates the fields for temporary structs which consists of the fields that should be
/// encrypted/decrypted
fn generate_struct_fields(&self, fields: &[(Field, Ident)]) -> Vec<proc_macro2::TokenStream> {
fn generate_struct_fields(self, fields: &[(Field, Ident)]) -> Vec<proc_macro2::TokenStream> {
fields
.iter()
.map(|(field, inner_ty)| {
@ -162,7 +162,7 @@ impl StructType {
/// Generates the ToEncryptable trait implementation
fn generate_impls(
&self,
self,
gen1: proc_macro2::TokenStream,
gen2: proc_macro2::TokenStream,
gen3: proc_macro2::TokenStream,
@ -177,7 +177,7 @@ impl StructType {
let field_ident = &field.ident;
let field_ident_string = field_ident.as_ref().map(|s| s.to_string());
if is_option || *self == Self::Updated {
if is_option || self == Self::Updated {
quote! { self.#field_ident.map(|s| map.insert(#field_ident_string.to_string(), s)) }
} else {
quote! { map.insert(#field_ident_string.to_string(), self.#field_ident) }
@ -191,7 +191,7 @@ impl StructType {
let field_ident = &field.ident;
let field_ident_string = field_ident.as_ref().map(|s| s.to_string());
if is_option || *self == Self::Updated {
if is_option || self == Self::Updated {
quote! { #field_ident: map.remove(#field_ident_string) }
} else {
quote! {