Merge pull request #2154 from topecongiro/issue-2151
Look for a newline after match arm only when there is one
This commit is contained in:
commit
5a91e0f7e3
@ -602,7 +602,11 @@ where
|
||||
// Match arms may not have trailing comma. In any case, for match arms,
|
||||
// we will assume that the post comment belongs to the next arm if they
|
||||
// do not end with trailing comma.
|
||||
1
|
||||
if let Some(newline_index) = newline_index {
|
||||
newline_index + 1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
None => post_snippet
|
||||
|
@ -435,6 +435,15 @@ impl<'tcx> Const<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
// #2151
|
||||
fn issue_2151() {
|
||||
match either {
|
||||
x => {
|
||||
|
||||
}y => ()
|
||||
}
|
||||
}
|
||||
|
||||
// #2152
|
||||
fn issue_2152() {
|
||||
match m {
|
||||
|
@ -128,15 +128,13 @@ fn issue339() {
|
||||
h => {
|
||||
// comment above block
|
||||
}
|
||||
i => {}
|
||||
// comment below block
|
||||
i => {} // comment below block
|
||||
j => {
|
||||
// comment inside block
|
||||
}
|
||||
j2 => {
|
||||
// comments inside...
|
||||
}
|
||||
// ... and after
|
||||
} // ... and after
|
||||
// TODO uncomment when vertical whitespace is handled better
|
||||
// k => {
|
||||
//
|
||||
@ -476,6 +474,14 @@ impl<'tcx> Const<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
// #2151
|
||||
fn issue_2151() {
|
||||
match either {
|
||||
x => {}
|
||||
y => (),
|
||||
}
|
||||
}
|
||||
|
||||
// #2152
|
||||
fn issue_2152() {
|
||||
match m {
|
||||
|
Loading…
x
Reference in New Issue
Block a user