From 3738f9759879428ec0e87f8716585a78bc964968 Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Sat, 8 Jul 2017 21:44:22 +0200 Subject: 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. --- src/codegen/helpers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/codegen/helpers.rs') 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 { -- cgit v1.2.3