Skip to content

Commit

Permalink
Fix constructed idents to inherit span from original Ident
Browse files Browse the repository at this point in the history
The code added to strip raw idents is unnecessary as the macro does
that for you if you read the docs and learn that you should be
passing the Ident, not a string-converted version of the Ident.
  • Loading branch information
csnover committed Nov 15, 2022
1 parent b161cd5 commit 448b0cd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions binrw_derive/src/binrw/codegen/sanitization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,5 @@ ident_str! {
}

pub(crate) fn make_ident(ident: &Ident, kind: &str) -> Ident {
let ident_string = ident.to_string();
let ident_string = ident_string.strip_prefix("r#").unwrap_or(&ident_string);
format_ident!("__binrw_generated_{}_{}", kind, ident_string)
format_ident!("__binrw_generated_{}_{}", kind, ident)
}

0 comments on commit 448b0cd

Please sign in to comment.