mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Merge pull request #3453 from scampi/issue-3423
remove trailing whitespaces in missing spans
This commit is contained in:
commit
ad6d89842a
@ -252,7 +252,12 @@ impl<'a> FmtVisitor<'a> {
|
||||
// - if there isn't one already
|
||||
// - otherwise, only if the last line is a line comment
|
||||
if status.line_start <= snippet.len() {
|
||||
match snippet[status.line_start..].chars().next() {
|
||||
match snippet[status.line_start..]
|
||||
.chars()
|
||||
// skip trailing whitespaces
|
||||
.skip_while(|c| *c == ' ' || *c == '\t')
|
||||
.next()
|
||||
{
|
||||
Some('\n') | Some('\r') => {
|
||||
if !subslice.trim_end().ends_with("*/") {
|
||||
self.push_str("\n");
|
||||
|
5
tests/source/issue-3423.rs
Normal file
5
tests/source/issue-3423.rs
Normal file
@ -0,0 +1,5 @@
|
||||
/* a nice comment with a trailing whitespace */
|
||||
fn foo() {}
|
||||
|
||||
/* a nice comment with a trailing tab */
|
||||
fn bar() {}
|
5
tests/target/issue-3423.rs
Normal file
5
tests/target/issue-3423.rs
Normal file
@ -0,0 +1,5 @@
|
||||
/* a nice comment with a trailing whitespace */
|
||||
fn foo() {}
|
||||
|
||||
/* a nice comment with a trailing tab */
|
||||
fn bar() {}
|
Loading…
Reference in New Issue
Block a user