diff options
author | Lukas Wirth <[email protected]> | 2020-09-05 14:51:26 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2020-09-05 14:51:26 +0100 |
commit | 7ccb198af81d8f33ccad66a417ae6529f91df625 (patch) | |
tree | 4ca7178f474eab6656a6acb482fffdf2f2b464ed /crates/assists/src/utils/insert_use.rs | |
parent | d201317c67eb1310ff775cf2164c9f4731c72c83 (diff) |
Remove duplicated import merge logic
Diffstat (limited to 'crates/assists/src/utils/insert_use.rs')
-rw-r--r-- | crates/assists/src/utils/insert_use.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs index 1cb52318a..a920e12c5 100644 --- a/crates/assists/src/utils/insert_use.rs +++ b/crates/assists/src/utils/insert_use.rs | |||
@@ -143,8 +143,13 @@ pub(crate) fn try_merge_imports( | |||
143 | new: &ast::Use, | 143 | new: &ast::Use, |
144 | merge_behaviour: MergeBehaviour, | 144 | merge_behaviour: MergeBehaviour, |
145 | ) -> Option<ast::Use> { | 145 | ) -> Option<ast::Use> { |
146 | // don't merge into re-exports | 146 | // don't merge imports with different visibilities |
147 | if old.visibility().and_then(|vis| vis.pub_token()).is_some() { | 147 | if old |
148 | .visibility() | ||
149 | .and_then(|vis| vis.pub_token()) | ||
150 | .or_else(|| new.visibility().and_then(|vis| vis.pub_token())) | ||
151 | .is_some() | ||
152 | { | ||
148 | return None; | 153 | return None; |
149 | } | 154 | } |
150 | let old_tree = old.use_tree()?; | 155 | let old_tree = old.use_tree()?; |