From: Matt Corallo Date: Tue, 28 Jun 2022 02:17:18 +0000 (+0000) Subject: Print field documentation even for unnamed enum variant fields X-Git-Tag: v0.0.108.0^2~16 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=2e91e812f6172965fed6fed63dc3adf9883aec56;p=ldk-c-bindings Print field documentation even for unnamed enum variant fields --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 508d392..7749ff4 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1625,14 +1625,17 @@ fn writeln_enum<'a, 'b, W: std::io::Write>(w: &mut W, e: &'a syn::ItemEnum, type } if !empty_tuple_variant { needs_free = true; - write!(w, "(").unwrap(); + writeln!(w, "(").unwrap(); for (idx, field) in fields.unnamed.iter().enumerate() { if export_status(&field.attrs) == ExportStatus::TestOnly { continue; } - write!(&mut constr, "{}: ", ('a' as u8 + idx as u8) as char).unwrap(); + writeln_field_docs(w, &field.attrs, "\t\t", types, Some(&gen_types), &field.ty); + write!(w, "\t\t").unwrap(); types.write_c_type(w, &field.ty, Some(&gen_types), true); + + write!(&mut constr, "{}: ", ('a' as u8 + idx as u8) as char).unwrap(); types.write_c_type(&mut constr, &field.ty, Some(&gen_types), false); if idx != fields.unnamed.len() - 1 { - write!(w, ",").unwrap(); + writeln!(w, ",").unwrap(); write!(&mut constr, ",").unwrap(); } }