File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
crates/stackable-versioned-macros/src/codegen/common Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -58,18 +58,26 @@ pub(crate) fn format_container_from_ident(ident: &Ident) -> Ident {
58
58
///
59
59
/// See [`DEPRECATED_FIELD_PREFIX`].
60
60
pub ( crate ) fn remove_deprecated_field_prefix ( ident : & Ident ) -> Ident {
61
- remove_ident_prefix ( ident, DEPRECATED_FIELD_PREFIX )
61
+ format_ident ! (
62
+ "{}" ,
63
+ ident
64
+ . to_string( )
65
+ . trim_start_matches( DEPRECATED_FIELD_PREFIX )
66
+ )
62
67
}
63
68
64
69
/// Removes the deprecated prefix from a variant ident.
65
70
///
66
71
/// See [`DEPRECATED_VARIANT_PREFIX`].
67
72
pub ( crate ) fn remove_deprecated_variant_prefix ( ident : & Ident ) -> Ident {
68
- remove_ident_prefix ( ident, DEPRECATED_VARIANT_PREFIX )
69
- }
70
-
71
- /// Removes the provided prefix from an ident and returns the newly created
72
- /// ident.
73
- pub ( crate ) fn remove_ident_prefix ( ident : & Ident , prefix : & str ) -> Ident {
74
- format_ident ! ( "{}" , ident. to_string( ) . trim_start_matches( prefix) )
73
+ // NOTE (@Techassi): Currently Clippy only issues a warning for variants
74
+ // with underscores in their name. That's why we additionally remove the
75
+ // underscore from the ident to use the expected name during code generation.
76
+ format_ident ! (
77
+ "{}" ,
78
+ ident
79
+ . to_string( )
80
+ . trim_start_matches( DEPRECATED_VARIANT_PREFIX )
81
+ . trim_start_matches( '_' )
82
+ )
75
83
}
You can’t perform that action at this time.
0 commit comments