Skip to content

Commit 6db001e

Browse files
authored
Merge pull request #1079 from rmnscnce/glib-macros-strip-raw-ident
glib-macros: Strip raw identifier prefix from struct members for the Properties macro
2 parents e8e8318 + 5af9158 commit 6db001e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

glib-macros/src/properties.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ fn expand_wrapper_notify_prop(props: &[PropDesc]) -> TokenStream2 {
585585
quote!(#(#emit_fns)*)
586586
}
587587

588-
fn name_to_enum_ident(mut name: String) -> syn::Ident {
588+
fn name_to_enum_ident(name: String) -> syn::Ident {
589+
let mut name = name.strip_prefix("r#").unwrap_or(&name).to_owned();
589590
let mut slice = name.as_mut_str();
590591
while let Some(i) = slice.find('-') {
591592
let (head, tail) = slice.split_at_mut(i);
@@ -606,6 +607,7 @@ fn expand_properties_enum(props: &[PropDesc]) -> TokenStream2 {
606607
.iter()
607608
.map(|p| {
608609
let name: String = p.name.value();
610+
609611
name_to_enum_ident(name)
610612
})
611613
.collect();

0 commit comments

Comments
 (0)