mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Merge pull request #2270 from topecongiro/issue-2260
Trim a trailing whitespace on empty line inside code block comment
This commit is contained in:
commit
3c08da3433
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
// ```
|
||||
}
|
||||
|
@ -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);
|
||||
// ```
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user