From 35c51b2866f9d4f5b1fa1084957f0d15414a5456 Mon Sep 17 00:00:00 2001 From: vaikzs Date: Sat, 10 Jun 2023 21:39:40 -0700 Subject: [PATCH] fix: writing insertion before all derives --- protobuf-codegen/src/gen/message.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/protobuf-codegen/src/gen/message.rs b/protobuf-codegen/src/gen/message.rs index 3471f876d..bd8a1098a 100644 --- a/protobuf-codegen/src/gen/message.rs +++ b/protobuf-codegen/src/gen/message.rs @@ -568,17 +568,18 @@ impl<'a> MessageGen<'a> { } fn write_struct(&self, w: &mut CodeWriter) { + write_protoc_insertion_point_for_message( + w, + &self.customize.for_elem, + &self.message_descriptor, + ); let mut derive = Vec::new(); if self.supports_derive_partial_eq() { derive.push("PartialEq"); } derive.extend(&["Clone", "Default", "Debug"]); w.derive(&derive); - write_protoc_insertion_point_for_message( - w, - &self.customize.for_elem, - &self.message_descriptor, - ); + w.pub_struct(&format!("{}", self.rust_name()), |w| { if !self.fields_except_oneof().is_empty() { w.comment("message fields");