More future-proof comment kind

This commit is contained in:
Aleksey Kladov 2019-04-02 12:18:52 +03:00
parent d21a677715
commit 5287a2506c
4 changed files with 59 additions and 37 deletions

View file

@ -145,7 +145,10 @@ fn contiguous_range_for_comment<'a>(
visited.insert(first);
// Only fold comments of the same flavor
let group_flavor = first.flavor();
let group_kind = first.kind();
if !group_kind.shape.is_line() {
return None;
}
let mut last = first;
for element in first.syntax().siblings_with_tokens(Direction::Next) {
@ -158,7 +161,7 @@ fn contiguous_range_for_comment<'a>(
}
}
if let Some(c) = ast::Comment::cast(token) {
if c.flavor() == group_flavor {
if c.kind() == group_kind {
visited.insert(c);
last = c;
continue;