Check existence of pre comment explicitly

This commit fixes #1428.
This commit is contained in:
topecongiro 2017-03-31 21:57:29 +09:00
parent 3edc184221
commit 34b90d8716
3 changed files with 7 additions and 1 deletions

View File

@ -350,7 +350,9 @@ fn next(&mut self) -> Option<Self::Item> {
.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

View File

@ -178,3 +178,5 @@ struct Deep {
Type,
NodeType>,
}
struct Foo<C=()>(String);

View File

@ -182,3 +182,5 @@ struct Deep {
deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep:
node::Handle<IdRef<'id, Node<Key, Value>>, Type, NodeType>,
}
struct Foo<C = ()>(String);