diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-18 22:23:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-18 22:23:22 +0100 |
commit | d9666ce5098442ab0cbac4d4363435074eb12923 (patch) | |
tree | f384246a35bb32f1d7ecc39c966150fd175f00c2 /crates/syntax | |
parent | 4f6301b8f6ff79bc5114d400bdce31dc3f37216b (diff) | |
parent | 2ee090faaf69474a2baadf0494ef3c6ed4fdbcbc (diff) |
Merge #9334
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril
On by default as I feel like this is something the majority would prefer.
Closes #8490
Co-authored-by: Lukas Wirth <[email protected]>
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() |