diff options
author | Lukas Wirth <[email protected]> | 2021-06-18 22:11:56 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-18 22:11:56 +0100 |
commit | 2ee090faaf69474a2baadf0494ef3c6ed4fdbcbc (patch) | |
tree | e67e1f3404fefb2dc3999b94f86bc9cbcca33dd1 /crates/syntax | |
parent | 84507a0b9c2e8f6e632ad9ec649cd1f21a7e0887 (diff) |
Allow to disable import insertion on single path glob imports
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 9 |
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 | |||
285 | impl 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 | |||
284 | impl ast::UseTree { | 293 | impl 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() |