Skip to content

Commit

Permalink
Skip Rust's escaping (SeaQL#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardWGNR committed Jul 13, 2024
1 parent f27a74b commit 018b456
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sea-query-attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ pub fn enum_def(args: TokenStream, input: TokenStream) -> TokenStream {
.iter()
.map(|field| {
let ident = &field.ident;
let string = ident
.as_ref()
.expect("#[enum_def] can only be used on structs with named fields")
.to_string();
let string = {
let mut inner = ident
.as_ref()
.expect("#[enum_def] can only be used on structs with named fields")
.to_string();

if inner.starts_with("r#") {
inner = (&inner[2..]).to_string();
}

inner
};
let as_pascal = string.to_pascal_case();
NamingHolder {
default: ident.as_ref().unwrap().clone(),
Expand Down

0 comments on commit 018b456

Please sign in to comment.