rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.06k stars 892 forks source link

Fix incorrect separator for match arms (#6373) #6376

Open mfarberbrodsky opened 1 month ago

mfarberbrodsky commented 1 month ago

Fixes #6373

The post_comment member of the ListItem corresponding to the first match arm in the test contained the trailing comma, even though it should have been trimmed. The reason it wasn't trimmed is that the separator for the match arms list was pipe | rather than comma ,.

ytmimi commented 1 month ago

Thanks for the PR. Can you add some additional test cases where the match arms aren't separated by commas. For example, when each arm has a block body.

calebcartwright commented 1 month ago

and also some where the arm patterns have leading pipes (with match_arm_leading_pipes configured to add/preserve pipes)