Merge pull request #2270 from topecongiro/issue-2260

Trim a trailing whitespace on empty line inside code block comment
This commit is contained in:
Nick Cameron 2017-12-11 16:40:12 +13:00 committed by GitHub
commit 3c08da3433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -332,7 +332,11 @@ fn rewrite_comment_inner(
inside_code_block = !inside_code_block;
}
if inside_code_block {
result.push_str(line);
if line.is_empty() && result.ends_with(' ') {
result.pop();
} else {
result.push_str(line);
}
continue;
}

View File

@ -5,3 +5,11 @@
fn main() {
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
}
fn code_block() {
// ```rust
// let x = 3;
//
// println!("x = {}", x);
// ```
}

View File

@ -10,3 +10,11 @@ fn main() {
// nostrud exercitation ullamco laboris nisi
// ut aliquip ex ea commodo consequat.
}
fn code_block() {
// ```rust
// let x = 3;
//
// println!("x = {}", x);
// ```
}