Merge pull request #3318 from rchaser53/issue-3314

fix Removed indentation after nested comments error
This commit is contained in:
Seiichi Uchida 2019-02-05 14:03:05 +09:00 committed by GitHub
commit aec0a7c999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -321,6 +321,7 @@ fn identify_comment(
// for a block comment, search for the closing symbol
CommentStyle::DoubleBullet | CommentStyle::SingleBullet | CommentStyle::Exclamation => {
let closer = style.closer().trim_start();
let mut count = orig.matches(closer).count();
let mut closing_symbol_offset = 0;
let mut hbl = false;
let mut first = true;
@ -341,7 +342,10 @@ fn identify_comment(
first = false;
}
if trimmed_line.ends_with(closer) {
break;
count -= 1;
if count == 0 {
break;
}
}
}
(hbl, closing_symbol_offset)

View File

@ -0,0 +1,5 @@
/*code
/*code*/
if true {
println!("1");
}*/

View File

@ -0,0 +1,5 @@
/*code
/*code*/
if true {
println!("1");
}*/