diff --git a/src/lists.rs b/src/lists.rs
index 301e9101c8f..9c6111bde61 100644
--- a/src/lists.rs
+++ b/src/lists.rs
@@ -641,7 +641,7 @@ where
self.prev_span_end = (self.get_hi)(&item) + BytePos(comment_end as u32);
let post_snippet = post_snippet[..comment_end].trim();
- let post_snippet_trimmed = if post_snippet.starts_with(',') {
+ let post_snippet_trimmed = if post_snippet.starts_with(|c| c == ',' || c == ':') {
post_snippet[1..].trim_matches(white_space)
} else if post_snippet.ends_with(',') {
post_snippet[..(post_snippet.len() - 1)].trim_matches(white_space)
diff --git a/tests/source/structs.rs b/tests/source/structs.rs
index b759943292f..b782c98635a 100644
--- a/tests/source/structs.rs
+++ b/tests/source/structs.rs
@@ -15,6 +15,11 @@ pub struct Foo {
pub i: TypeForPublicField
}
+// #1095
+struct S {
+ t: T,
+}
+
// #1029
pub struct Foo {
#[doc(hidden)]
diff --git a/tests/target/structs.rs b/tests/target/structs.rs
index a4c26269f8e..8284618bc39 100644
--- a/tests/target/structs.rs
+++ b/tests/target/structs.rs
@@ -14,6 +14,11 @@ pub struct Foo {
pub i: TypeForPublicField,
}
+// #1095
+struct S {
+ t: T,
+}
+
// #1029
pub struct Foo {
#[doc(hidden)]