Skip to content

Commit f6c0bf8

Browse files
committed
Auto merge of rust-lang#12642 - weirdsmiley:master, r=Veykril
fix: deduplicate cfg completions cfg completions are duplicated if they are set with multiple values. This patch deduplicates them. fixes: [rust-lang#12623](rust-lang/rust-analyzer#12623)
2 parents b74e96f + 7f1fac7 commit f6c0bf8

File tree

1 file changed

+2
-1
lines changed
  • crates/ide-completion/src/completions/attribute

1 file changed

+2
-1
lines changed

crates/ide-completion/src/completions/attribute/cfg.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::iter;
44

55
use ide_db::SymbolKind;
6+
use itertools::Itertools;
67
use syntax::SyntaxKind;
78

89
use crate::{completions::Completions, context::CompletionContext, CompletionItem};
@@ -34,7 +35,7 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext) {
3435

3536
acc.add(item.build());
3637
}),
37-
None => ctx.krate.potential_cfg(ctx.db).get_cfg_keys().cloned().for_each(|s| {
38+
None => ctx.krate.potential_cfg(ctx.db).get_cfg_keys().cloned().unique().for_each(|s| {
3839
let item = CompletionItem::new(SymbolKind::BuiltinAttr, ctx.source_range(), s);
3940
acc.add(item.build());
4041
}),

0 commit comments

Comments
 (0)