]> git.lizzy.rs Git - rust.git/commitdiff
Force vertical layout when we find any kind of single line comments
authortopecongiro <seuchida@gmail.com>
Thu, 23 Nov 2017 03:37:12 +0000 (12:37 +0900)
committertopecongiro <seuchida@gmail.com>
Thu, 23 Nov 2017 03:37:12 +0000 (12:37 +0900)
src/lists.rs

index b80d8d6541eb7a6334953760c5f248df1e891255..1e073945c0b1eb79dfe06a9204a51c92c9dc62ee 100644 (file)
@@ -137,10 +137,10 @@ pub fn is_multiline(&self) -> bool {
     pub fn has_comment(&self) -> bool {
         self.pre_comment
             .as_ref()
-            .map_or(false, |comment| comment.starts_with("//"))
+            .map_or(false, |comment| comment.trim_left().starts_with("//"))
             || self.post_comment
                 .as_ref()
-                .map_or(false, |comment| comment.starts_with("//"))
+                .map_or(false, |comment| comment.trim_left().starts_with("//"))
     }
 
     pub fn from_str<S: Into<String>>(s: S) -> ListItem {