diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-27 02:48:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-27 02:48:36 +0100 |
commit | 61ebc3572d03bb484740b08a91ac5c83a6dd92e3 (patch) | |
tree | 3192e07f5e0bd772e47f65be732fa8fd590b3e8b /crates/ide_completion/src/completions/macro_in_item_position.rs | |
parent | 12d46f835e5619f1731b3697c46065f4b737758c (diff) | |
parent | 30948e1ecb2fb4fe35bf9c5c1e49464d4ea1d064 (diff) |
Merge #9019
9019: internal: simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions/macro_in_item_position.rs')
-rw-r--r-- | crates/ide_completion/src/completions/macro_in_item_position.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/ide_completion/src/completions/macro_in_item_position.rs b/crates/ide_completion/src/completions/macro_in_item_position.rs index 2be299ac2..c5e377500 100644 --- a/crates/ide_completion/src/completions/macro_in_item_position.rs +++ b/crates/ide_completion/src/completions/macro_in_item_position.rs | |||
@@ -4,13 +4,15 @@ use crate::{CompletionContext, Completions}; | |||
4 | 4 | ||
5 | pub(crate) fn complete_macro_in_item_position(acc: &mut Completions, ctx: &CompletionContext) { | 5 | pub(crate) fn complete_macro_in_item_position(acc: &mut Completions, ctx: &CompletionContext) { |
6 | // Show only macros in top level. | 6 | // Show only macros in top level. |
7 | if ctx.is_new_item { | 7 | if !ctx.is_new_item { |
8 | ctx.scope.process_all_names(&mut |name, res| { | 8 | return; |
9 | if let hir::ScopeDef::MacroDef(mac) = res { | ||
10 | acc.add_macro(ctx, Some(name.to_string()), mac); | ||
11 | } | ||
12 | }) | ||
13 | } | 9 | } |
10 | |||
11 | ctx.scope.process_all_names(&mut |name, res| { | ||
12 | if let hir::ScopeDef::MacroDef(mac) = res { | ||
13 | acc.add_macro(ctx, Some(name.to_string()), mac); | ||
14 | } | ||
15 | }) | ||
14 | } | 16 | } |
15 | 17 | ||
16 | #[cfg(test)] | 18 | #[cfg(test)] |