Skip to content

Commit

Permalink
refactor: address cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
GoranBrkuljan committed Dec 18, 2024
1 parent 779baac commit b640fbe
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions charybdis-macros/src/rules/partial.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::{Attribute, DeriveInput, parse_str};
use syn::{parse_str, Attribute, DeriveInput};

use charybdis_parser::fields::CharybdisFields;
use charybdis_parser::traits::CharybdisMacroArgs;
use charybdis_parser::traits::string::ToSnakeCase;
use charybdis_parser::traits::CharybdisMacroArgs;

use crate::traits::fields::{FieldHashMapString, ToIdents};

Expand Down Expand Up @@ -117,7 +117,6 @@ use crate::traits::fields::{FieldHashMapString, ToIdents};
/// However, all partition keys are required for db operations, so we can't have partial partition
/// keys.
///
pub(crate) fn partial_model_macro_generator(
input: &DeriveInput,
args: &CharybdisMacroArgs,
Expand Down
8 changes: 4 additions & 4 deletions charybdis-macros/src/traits/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<T: FieldsAsTuple> Tuple for T {
fn types_tp(&self) -> TokenStream {
let types = self.types();

return if types.len() == 1 {
if types.len() == 1 {
let single_type = types.first().unwrap();
quote! {
(#single_type,)
Expand All @@ -68,13 +68,13 @@ impl<T: FieldsAsTuple> Tuple for T {
quote! {
(#(#types),*)
}
};
}
}

fn values_tp(&self) -> TokenStream {
let values = self.values();

return if values.len() == 1 {
if values.len() == 1 {
let single_value = values.first().unwrap();
quote! {
(#single_value,)
Expand All @@ -83,6 +83,6 @@ impl<T: FieldsAsTuple> Tuple for T {
quote! {
(#(#values),*)
}
};
}
}
}
6 changes: 3 additions & 3 deletions charybdis/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl<'a, Val: SerializeRow, M: Model> CharybdisModelBatch<'a, Val, M> {
}
}

impl<'a, Val: SerializeRow, M: Model> Default for CharybdisModelBatch<'a, Val, M> {
impl<Val: SerializeRow, M: Model> Default for CharybdisModelBatch<'_, Val, M> {
fn default() -> Self {
Self::new()
}
Expand Down Expand Up @@ -352,7 +352,7 @@ impl<'a> SerializeRowBox<'a> {
}
}

impl<'a> SerializeRow for SerializeRowBox<'a> {
impl SerializeRow for SerializeRowBox<'_> {
fn serialize(&self, ctx: &RowSerializationContext<'_>, writer: &mut RowWriter) -> Result<(), SerializationError> {
self.inner.as_ref().serialize(ctx, writer)
}
Expand Down Expand Up @@ -405,7 +405,7 @@ impl<'a> CharybdisBatch<'a> {
}
}

impl<'a> Default for CharybdisBatch<'a> {
impl Default for CharybdisBatch<'_> {
fn default() -> Self {
Self::new()
}
Expand Down
2 changes: 1 addition & 1 deletion charybdis/src/operations/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ pub trait DeleteWithCallbacks<'a>: Callbacks {
}
}

impl<'a, M: Callbacks> DeleteWithCallbacks<'a> for M {}
impl<M: Callbacks> DeleteWithCallbacks<'_> for M {}
2 changes: 1 addition & 1 deletion charybdis/src/operations/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ pub trait InsertWithCallbacks<'a>: Callbacks {
}
}

impl<'a, M: Callbacks> InsertWithCallbacks<'a> for M {}
impl<M: Callbacks> InsertWithCallbacks<'_> for M {}
2 changes: 1 addition & 1 deletion charybdis/src/operations/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ pub trait UpdateWithCallbacks<'a>: Callbacks {
}
}

impl<'a, M: Callbacks> UpdateWithCallbacks<'a> for M {}
impl<M: Callbacks> UpdateWithCallbacks<'_> for M {}

0 comments on commit b640fbe

Please sign in to comment.