diff options
author | Oliver Geller <oliver.geller@rochester.edu> | 2017-10-04 14:07:24 -0400 |
---|---|---|
committer | Oliver Geller <oliver.geller@rochester.edu> | 2017-10-04 17:05:54 -0400 |
commit | a1ee87f02764eed3b87d452178547cca9df0aa58 (patch) | |
tree | 71ec62986d307f0c74840e966bc42ccbf19ea5c9 /src/codegen/impl_debug.rs | |
parent | 4e74c3926154174856542f172ed81169420b62ba (diff) |
Remove early anonymous bitfield filtering and consolidate name method
Diffstat (limited to 'src/codegen/impl_debug.rs')
-rw-r--r-- | src/codegen/impl_debug.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/codegen/impl_debug.rs b/src/codegen/impl_debug.rs index 7ef108da..2ebcaf1a 100644 --- a/src/codegen/impl_debug.rs +++ b/src/codegen/impl_debug.rs @@ -95,11 +95,14 @@ impl<'a> ImplDebug<'a> for BitfieldUnit { if i > 0 { format_string.push_str(", "); } - format_string.push_str(&format!("{} : {{:?}}", bu.name())); - let name_ident = ctx.rust_ident_raw(bu.name()); - tokens.push(quote! { - self.#name_ident () - }); + + if let Some(name) = bu.name() { + format_string.push_str(&format!("{} : {{:?}}", name)); + let name_ident = ctx.rust_ident_raw(name); + tokens.push(quote! { + self.#name_ident () + }); + } } Some((format_string, tokens)) |