Skip to content

Commit

Permalink
style: Update format_ident call
Browse files Browse the repository at this point in the history
  • Loading branch information
Techassi committed Aug 21, 2024
1 parent 403a649 commit 828200e
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions crates/stackable-versioned-macros/src/codegen/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ pub(crate) fn format_container_from_ident(ident: &Ident) -> Ident {
///
/// See [`DEPRECATED_FIELD_PREFIX`].
pub(crate) fn remove_deprecated_field_prefix(ident: &Ident) -> Ident {
format_ident!(
"{}",
ident
.to_string()
.trim_start_matches(DEPRECATED_FIELD_PREFIX)
)
let ident = ident.to_string();
let ident = ident.trim_start_matches(DEPRECATED_FIELD_PREFIX);

format_ident!("{ident}",)
}

/// Removes the deprecated prefix from a variant ident.
Expand All @@ -73,11 +71,10 @@ pub(crate) fn remove_deprecated_variant_prefix(ident: &Ident) -> Ident {
// NOTE (@Techassi): Currently Clippy only issues a warning for variants
// with underscores in their name. That's why we additionally remove the
// underscore from the ident to use the expected name during code generation.
format_ident!(
"{}",
ident
.to_string()
.trim_start_matches(DEPRECATED_VARIANT_PREFIX)
.trim_start_matches('_')
)
let ident = ident.to_string();
let ident = ident
.trim_start_matches(DEPRECATED_VARIANT_PREFIX)
.trim_start_matches('_');

format_ident!("{ident}",)
}

0 comments on commit 828200e

Please sign in to comment.