Skip to content

Commit aab29c4

Browse files
committed
Handle use of #[doc] in the original source
1 parent cd17838 commit aab29c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

c-bindings-gen/src/blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut
442442
match token_iter.next().unwrap() {
443443
TokenTree::Literal(lit) => {
444444
// Drop the first and last chars from lit as they are always "
445-
let doc = format!("{}", lit);
445+
let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}//!", prefix));
446446
writeln!(w, "{}//!{}", prefix, &doc[1..doc.len() - 1]).unwrap();
447447
},
448448
_ => unimplemented!(),
@@ -452,7 +452,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut
452452
match token_iter.next().unwrap() {
453453
TokenTree::Literal(lit) => {
454454
// Drop the first and last chars from lit as they are always "
455-
let doc = format!("{}", lit);
455+
let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}///", prefix));
456456
writeln!(w, "{}///{}", prefix, &doc[1..doc.len() - 1]).unwrap();
457457
},
458458
_ => unimplemented!(),

0 commit comments

Comments
 (0)