From aab29c474f02e0b291d305db2a1cac35eff8af81 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 25 Apr 2023 20:20:13 +0000 Subject: [PATCH] Handle use of `#[doc]` in the original source --- c-bindings-gen/src/blocks.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c-bindings-gen/src/blocks.rs b/c-bindings-gen/src/blocks.rs index 28f3002..e419fe0 100644 --- a/c-bindings-gen/src/blocks.rs +++ b/c-bindings-gen/src/blocks.rs @@ -442,7 +442,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut match token_iter.next().unwrap() { TokenTree::Literal(lit) => { // Drop the first and last chars from lit as they are always " - let doc = format!("{}", lit); + let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}//!", prefix)); writeln!(w, "{}//!{}", prefix, &doc[1..doc.len() - 1]).unwrap(); }, _ => unimplemented!(), @@ -452,7 +452,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut match token_iter.next().unwrap() { TokenTree::Literal(lit) => { // Drop the first and last chars from lit as they are always " - let doc = format!("{}", lit); + let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}///", prefix)); writeln!(w, "{}///{}", prefix, &doc[1..doc.len() - 1]).unwrap(); }, _ => unimplemented!(), -- 2.39.5