Fix index bug in write_snippet_inner

This commit is contained in:
topecongiro 2017-05-30 10:53:48 +09:00
parent b79094262f
commit 33a7357543
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");
}