Correctly indent skipped-over code

Closes #4398
This commit is contained in:
Ayaz Hafiz 2020-08-25 23:52:26 -05:00 committed by Caleb Cartwright
parent 2866634baf
commit e70343a5f5
3 changed files with 39 additions and 0 deletions

View File

@ -353,6 +353,7 @@ impl<'a> FmtVisitor<'a> {
let remaining = snippet[status.line_start..subslice.len() + offset].trim();
if !remaining.is_empty() {
self.push_str(&self.block_indent.to_string(self.config));
self.push_str(remaining);
status.line_start = subslice.len() + offset;
}

View File

@ -0,0 +1,19 @@
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
/// Documentation for `Struct`
#[rustfmt::skip] // comment
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}

View File

@ -0,0 +1,19 @@
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
/// Documentation for `Struct`
#[rustfmt::skip] // comment
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}