Skip to content

Commit c720a3a

Browse files
committed
Remove colon from faulty span
1 parent e6e696f commit c720a3a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/lists.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ where
641641
self.prev_span_end = (self.get_hi)(&item) + BytePos(comment_end as u32);
642642
let post_snippet = post_snippet[..comment_end].trim();
643643

644-
let post_snippet_trimmed = if post_snippet.starts_with(',') {
644+
let post_snippet_trimmed = if post_snippet.starts_with(|c| c == ',' || c == ':') {
645645
post_snippet[1..].trim_matches(white_space)
646646
} else if post_snippet.ends_with(',') {
647647
post_snippet[..(post_snippet.len() - 1)].trim_matches(white_space)

tests/source/structs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ pub struct Foo {
1515
pub i: TypeForPublicField
1616
}
1717

18+
// #1095
19+
struct S<T: /* comment */> {
20+
t: T,
21+
}
22+
1823
// #1029
1924
pub struct Foo {
2025
#[doc(hidden)]

tests/target/structs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ pub struct Foo {
1414
pub i: TypeForPublicField,
1515
}
1616

17+
// #1095
18+
struct S<T /* comment */> {
19+
t: T,
20+
}
21+
1722
// #1029
1823
pub struct Foo {
1924
#[doc(hidden)]

0 commit comments

Comments
 (0)