mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
Merge pull request #3533 from rchaser53/issue-3532
fix Comma in comment causes no formatting
This commit is contained in:
commit
8c94e2b104
@ -612,7 +612,7 @@ pub fn extract_post_comment(
|
||||
post_snippet[1..].trim_matches(white_space)
|
||||
} else if post_snippet.starts_with(separator) {
|
||||
post_snippet[separator.len()..].trim_matches(white_space)
|
||||
} else if post_snippet.ends_with(',') {
|
||||
} else if post_snippet.ends_with(',') && !post_snippet.trim().starts_with("//") {
|
||||
post_snippet[..(post_snippet.len() - 1)].trim_matches(white_space)
|
||||
} else {
|
||||
post_snippet
|
||||
|
7
tests/source/issue-3532.rs
Normal file
7
tests/source/issue-3532.rs
Normal file
@ -0,0 +1,7 @@
|
||||
fn foo(a: T) {
|
||||
match a {
|
||||
1 => {}
|
||||
0 => {}
|
||||
// _ => panic!("doesn't format!"),
|
||||
}
|
||||
}
|
6
tests/target/issue-3532.rs
Normal file
6
tests/target/issue-3532.rs
Normal file
@ -0,0 +1,6 @@
|
||||
fn foo(a: T) {
|
||||
match a {
|
||||
1 => {}
|
||||
0 => {} // _ => panic!("doesn't format!"),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user