summaryrefslogtreecommitdiff
path: root/src/codegen/helpers.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-07-08 21:44:22 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-07-10 23:16:59 +0200
commit3738f9759879428ec0e87f8716585a78bc964968 (patch)
treefe44687273c54628787cbbed4b37630d67a415bf /src/codegen/helpers.rs
parentffc529d11f73101076888c77f3a70f0f8554703e (diff)
codegen: Make comments indentation-aware.
This commit moves comment processing to a central place (well, two, because of field docs, but that's fine). Also, it makes comments indentation aware, so multiline comments don't appear garbled. Finally, it also fixes an out-of-bounds panic when processing an empty multiline comment.
Diffstat (limited to 'src/codegen/helpers.rs')
-rw-r--r--src/codegen/helpers.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs
index eb843a65..4a64f799 100644
--- a/src/codegen/helpers.rs
+++ b/src/codegen/helpers.rs
@@ -30,8 +30,8 @@ pub mod attributes {
aster::AstBuilder::new().attr().word("inline")
}
- pub fn doc(comment: &str) -> ast::Attribute {
- aster::AstBuilder::new().attr().doc(comment)
+ pub fn doc(comment: String) -> ast::Attribute {
+ aster::AstBuilder::new().attr().doc(&*comment)
}
pub fn link_name(name: &str) -> ast::Attribute {