Skip to content

Commit ec3586e

Browse files
committed
Auto merge of rust-lang#12904 - lnicola:completion-builtin-filter, r=lnicola
internal: Be more explicit when filtering built-in completions We return every built-in type here, but only have `u32` in the tests, so let's look for that one to make tests more reliable across platforms.
2 parents cab1055 + 11ef494 commit ec3586e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

crates/ide-completion/src/tests.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ mod type_pos;
2323
mod use_tree;
2424
mod visibility;
2525

26-
use std::mem;
27-
2826
use hir::{db::DefDatabase, PrefixKind, Semantics};
2927
use ide_db::{
3028
base_db::{fixture::ChangeFixture, FileLoader, FilePosition},
@@ -107,12 +105,9 @@ fn completion_list_with_config(
107105
) -> String {
108106
// filter out all but one builtintype completion for smaller test outputs
109107
let items = get_all_items(config, ra_fixture, trigger_character);
110-
let mut bt_seen = false;
111108
let items = items
112109
.into_iter()
113-
.filter(|it| {
114-
it.kind() != CompletionItemKind::BuiltinType || !mem::replace(&mut bt_seen, true)
115-
})
110+
.filter(|it| it.kind() != CompletionItemKind::BuiltinType || it.label() == "u32")
116111
.filter(|it| include_keywords || it.kind() != CompletionItemKind::Keyword)
117112
.filter(|it| include_keywords || it.kind() != CompletionItemKind::Snippet)
118113
.sorted_by_key(|it| (it.kind(), it.label().to_owned(), it.detail().map(ToOwned::to_owned)))

0 commit comments

Comments
 (0)