We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ce3593 commit 2426d42Copy full SHA for 2426d42
crates/syntax/src/ast/node_ext.rs
@@ -345,13 +345,20 @@ impl ast::UseTreeList {
345
.is_some()
346
}
347
348
+ pub fn comma(&self) -> impl Iterator<Item = SyntaxToken> {
349
+ self.syntax()
350
+ .children_with_tokens()
351
+ .filter_map(|it| it.into_token().filter(|it| it.kind() == T![,]))
352
+ }
353
+
354
/// Remove the unnecessary braces in current `UseTreeList`
355
pub fn remove_unnecessary_braces(mut self) {
356
let remove_brace_in_use_tree_list = |u: &ast::UseTreeList| {
357
let use_tree_count = u.use_trees().count();
358
if use_tree_count == 1 {
359
u.l_curly_token().map(ted::remove);
360
u.r_curly_token().map(ted::remove);
361
+ u.comma().for_each(ted::remove);
362
363
};
364
0 commit comments