Skip to content

Commit

Permalink
Fix incorrect separator for match arms
Browse files Browse the repository at this point in the history
  • Loading branch information
mfarberbrodsky committed Oct 25, 2024
1 parent 96cc01b commit 302a009
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn rewrite_match_arms(
.zip(beginning_verts.into_iter())
.map(|((arm, is_last), beginning_vert)| ArmWrapper::new(arm, is_last, beginning_vert)),
"}",
"|",
",",
|arm| arm.span().lo(),
|arm| arm.span().hi(),
|arm| arm.rewrite_result(context, arm_shape),
Expand Down
8 changes: 8 additions & 0 deletions tests/source/issue-6373.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
let x: Option<i32> = Some(10);
let value = match x {
Some(i) => i /* comment */,
None => 0,
};
println!("{}", value);
}
8 changes: 8 additions & 0 deletions tests/target/issue-6373.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
let x: Option<i32> = Some(10);
let value = match x {
Some(i) => i, /* comment */
None => 0,
};
println!("{}", value);
}

0 comments on commit 302a009

Please sign in to comment.