mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Merge pull request #3318 from rchaser53/issue-3314
fix Removed indentation after nested comments error
This commit is contained in:
commit
aec0a7c999
@ -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)
|
||||
|
5
tests/source/issue-3314.rs
Normal file
5
tests/source/issue-3314.rs
Normal file
@ -0,0 +1,5 @@
|
||||
/*code
|
||||
/*code*/
|
||||
if true {
|
||||
println!("1");
|
||||
}*/
|
5
tests/target/issue-3314.rs
Normal file
5
tests/target/issue-3314.rs
Normal file
@ -0,0 +1,5 @@
|
||||
/*code
|
||||
/*code*/
|
||||
if true {
|
||||
println!("1");
|
||||
}*/
|
Loading…
Reference in New Issue
Block a user