don't remove the comment token if it's last

This commit is contained in:
Jeroen Vannevel 2022-01-19 23:26:30 +00:00
parent 4f3dd5bc08
commit 50c913c733

View File

@ -1467,6 +1467,7 @@ fn make_body(
.filter(|it| text_range.contains_range(it.text_range()))
.map(|it| match it {
syntax::NodeOrToken::Node(n) => {
println!("Found node: {:?}", n);
return syntax::NodeOrToken::try_from(rewrite_body_segment(
ctx,
&fun.params,
@ -1476,6 +1477,7 @@ fn make_body(
.unwrap()
}
syntax::NodeOrToken::Token(t) => {
println!("Found token: {:?}", t);
return syntax::NodeOrToken::try_from(t).unwrap()
}
})
@ -1487,7 +1489,11 @@ fn make_body(
elements.push(node);
None
})
}
},
Some(token) if token.as_token().is_some() && token.as_token().unwrap().kind() == COMMENT => {
elements.push(token);
None
},
_ => None,
};