diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-09-17 09:44:06 +0900 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-09-17 11:53:23 +0900 |
commit | 2f621ddeae1081d4f223c4498ebf86a9ee0a7e7e (patch) | |
tree | 2b0c122f1a5e91b0927327c3b58a6b42123f51f1 /src/codegen/impl_debug.rs | |
parent | 3062841c207545c1c29f7541ac9d8e883a12264c (diff) |
Rustfmt.
Diffstat (limited to 'src/codegen/impl_debug.rs')
-rw-r--r-- | src/codegen/impl_debug.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/codegen/impl_debug.rs b/src/codegen/impl_debug.rs index fd486511..eac54fd1 100644 --- a/src/codegen/impl_debug.rs +++ b/src/codegen/impl_debug.rs @@ -1,7 +1,7 @@ use ir::comp::{BitfieldUnit, CompKind, Field, FieldData, FieldMethods}; use ir::context::BindgenContext; use ir::item::{HasTypeParamInArray, IsOpaque, Item, ItemCanonicalName}; -use ir::ty::{RUST_DERIVE_IN_ARRAY_LIMIT, TypeKind}; +use ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT}; use proc_macro2; pub fn gen_debug_impl( @@ -177,9 +177,10 @@ impl<'a> ImplDebug<'a> for Item { TypeKind::Array(_, len) => { // Generics are not required to implement Debug if self.has_type_param_in_array(ctx) { - Some( - (format!("{}: Array with length {}", name, len), vec![]), - ) + Some(( + format!("{}: Array with length {}", name, len), + vec![], + )) } else if len < RUST_DERIVE_IN_ARRAY_LIMIT { // The simple case debug_print(name, quote! { #name_ident }) @@ -187,9 +188,7 @@ impl<'a> ImplDebug<'a> for Item { if ctx.options().use_core { // There is no String in core; reducing field visibility to avoid breaking // no_std setups. - Some(( - format!("{}: [...]", name), vec![] - )) + Some((format!("{}: [...]", name), vec![])) } else { // Let's implement our own print function Some(( @@ -209,16 +208,14 @@ impl<'a> ImplDebug<'a> for Item { if ctx.options().use_core { // There is no format! in core; reducing field visibility to avoid breaking // no_std setups. - Some(( - format!("{}(...)", name), vec![] - )) + Some((format!("{}(...)", name), vec![])) } else { let self_ids = 0..len; Some(( format!("{}({{}})", name), vec![quote! { #(format!("{:?}", self.#self_ids)),* - }] + }], )) } } @@ -235,8 +232,9 @@ impl<'a> ImplDebug<'a> for Item { let inner_type = ctx.resolve_type(inner).canonical_type(ctx); match *inner_type.kind() { TypeKind::Function(ref sig) - if !sig.function_pointers_can_derive() => { - Some((format!("{}: FunctionPointer", name), vec![])) + if !sig.function_pointers_can_derive() => + { + Some((format!("{}: FunctionPointer", name), vec![])) } _ => debug_print(name, quote! { #name_ident }), } |