diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-13 21:39:38 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-13 21:40:06 +0100 |
| commit | 880b1847bd4170ce80be5781c2163ba085cdcaff (patch) | |
| tree | 3fbfdb70cb04c4922f0ec9e3f29f2c63d11d753b /macros/src/util.rs | |
| parent | cb3c263c4a67f4d361dbdb5048a1c073bd1fff96 (diff) | |
Derive `Cast` for enums
Diffstat (limited to 'macros/src/util.rs')
| -rw-r--r-- | macros/src/util.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/macros/src/util.rs b/macros/src/util.rs index d94ba932..53a8354e 100644 --- a/macros/src/util.rs +++ b/macros/src/util.rs @@ -1,3 +1,5 @@ +use heck::ToKebabCase; + use super::*; /// Return an error at the given item. @@ -55,7 +57,7 @@ pub fn validate_attrs(attrs: &[syn::Attribute]) -> Result<()> { /// Convert an identifier to a kebab-case string. pub fn kebab_case(name: &Ident) -> String { - name.to_string().to_lowercase().replace('_', "-") + name.to_string().to_kebab_case() } /// Extract documentation comments from an attribute list. |
