From 2e91e812f6172965fed6fed63dc3adf9883aec56 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 28 Jun 2022 02:17:18 +0000 Subject: [PATCH] Print field documentation even for unnamed enum variant fields --- c-bindings-gen/src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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(); } } -- 2.39.5