aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/node_ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index b057e6624..3c92a486f 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -281,6 +281,15 @@ impl ast::Path {
281 successors(self.qualifier(), |p| p.qualifier()) 281 successors(self.qualifier(), |p| p.qualifier())
282 } 282 }
283} 283}
284
285impl ast::Use {
286 pub fn is_simple_glob(&self) -> bool {
287 self.use_tree()
288 .map(|use_tree| use_tree.use_tree_list().is_none() && use_tree.star_token().is_some())
289 .unwrap_or(false)
290 }
291}
292
284impl ast::UseTree { 293impl ast::UseTree {
285 pub fn is_simple_path(&self) -> bool { 294 pub fn is_simple_path(&self) -> bool {
286 self.use_tree_list().is_none() && self.star_token().is_none() 295 self.use_tree_list().is_none() && self.star_token().is_none()