Skip to content

Commit

Permalink
Merge pull request #3318 from rchaser53/issue-3314
Browse files Browse the repository at this point in the history
fix Removed indentation after nested comments error
  • Loading branch information
topecongiro authored Feb 5, 2019
2 parents 81067b1 + 5fcb750 commit aec0a7c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions tests/source/issue-3314.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*code
/*code*/
if true {
println!("1");
}*/
5 changes: 5 additions & 0 deletions tests/target/issue-3314.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*code
/*code*/
if true {
println!("1");
}*/

0 comments on commit aec0a7c

Please sign in to comment.