diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-04-07 14:00:30 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-04-07 14:04:12 +0200 |
commit | 3258c5a949d2ef9290189b4b8fb2af635f1ba86a (patch) | |
tree | be4b63a9a1d04f3bef83427974e82adc54942dab /src/codegen/helpers.rs | |
parent | b678c8a891087869523f7d95f65b463f78ed4559 (diff) |
Make doc comments nice again.
Diffstat (limited to 'src/codegen/helpers.rs')
-rw-r--r-- | src/codegen/helpers.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs index a73f02ae..f1007c51 100644 --- a/src/codegen/helpers.rs +++ b/src/codegen/helpers.rs @@ -38,7 +38,14 @@ pub mod attributes { } pub fn doc(comment: String) -> quote::Tokens { - quote!(#[doc=#comment]) + // Doc comments are already preprocessed into nice `///` formats by the + // time they get here. Just make sure that we have newlines around it so + // that nothing else gets wrapped into the comment. + let mut tokens = quote! {}; + tokens.append(Term::new("\n", Span::call_site())); + tokens.append(Term::new(&comment, Span::call_site())); + tokens.append(Term::new("\n", Span::call_site())); + tokens } pub fn link_name(name: &str) -> quote::Tokens { |