From a1ee87f02764eed3b87d452178547cca9df0aa58 Mon Sep 17 00:00:00 2001 From: Oliver Geller Date: Wed, 4 Oct 2017 14:07:24 -0400 Subject: Remove early anonymous bitfield filtering and consolidate name method --- src/codegen/impl_debug.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/codegen/impl_debug.rs') 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)) -- cgit v1.2.3