Merge pull request #1608 from topecongiro/issue-1598

Fix index bug in write_snippet_inner
This commit is contained in:
Nick Cameron 2017-05-30 15:28:44 +12:00 committed by GitHub
commit cfa3d59974
2 changed files with 7 additions and 1 deletions

View file

@ -173,7 +173,7 @@ impl<'a> FmtVisitor<'a> {
if !subslice
.split('\n')
.map(|s| s.trim_left())
.any(|s| s.len() > 2 && &s[0..2] == "/*") {
.any(|s| s.len() >= 2 && &s[0..2] == "/*") {
// Add a newline after line comments
self.buffer.push_str("\n");
}

View file

@ -0,0 +1,6 @@
fn main() {
//foo
/*
*/
format!("hello");
}