Extract function for writing cxx_impl_annotations
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 4e802da..b0af714 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -623,13 +623,17 @@
writeln!(out, "}}");
}
+fn begin_function_definition(out: &mut OutFile) {
+ if let Some(annotation) = &out.opt.cxx_impl_annotations {
+ write!(out, "{} ", annotation);
+ }
+}
+
fn write_cxx_function_shim<'a>(out: &mut OutFile<'a>, efn: &'a ExternFn) {
out.next_section();
out.set_namespace(&efn.name.namespace);
out.begin_block(Block::ExternC);
- if let Some(annotation) = &out.opt.cxx_impl_annotations {
- write!(out, "{} ", annotation);
- }
+ begin_function_definition(out);
if efn.throws {
out.builtin.ptr_len = true;
write!(out, "::rust::repr::PtrLen ");