diff --git a/src/lists.rs b/src/lists.rs index 34ad6b26ea8..6b917ff29e6 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -350,7 +350,9 @@ fn next(&mut self) -> Option { .span_to_snippet(codemap::mk_sp(self.prev_span_end, (self.get_lo)(&item))) .unwrap(); let trimmed_pre_snippet = pre_snippet.trim(); - let pre_comment = if !trimmed_pre_snippet.is_empty() { + let has_pre_comment = trimmed_pre_snippet.contains("//") || + trimmed_pre_snippet.contains("/*"); + let pre_comment = if has_pre_comment { Some(trimmed_pre_snippet.to_owned()) } else { None diff --git a/tests/source/structs.rs b/tests/source/structs.rs index d7cfe7ec548..5786fef4839 100644 --- a/tests/source/structs.rs +++ b/tests/source/structs.rs @@ -178,3 +178,5 @@ struct Deep { Type, NodeType>, } + +struct Foo(String); diff --git a/tests/target/structs.rs b/tests/target/structs.rs index 7b4eb031f9f..2906d39759b 100644 --- a/tests/target/structs.rs +++ b/tests/target/structs.rs @@ -182,3 +182,5 @@ struct Deep { deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep: node::Handle>, Type, NodeType>, } + +struct Foo(String);