Skip to content

Commit c69f762

Browse files
bors[bot]Veykril
andauthored
Merge #9356
9356: internal: Move out and regroup more completion tests r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 488c9ef + 0729913 commit c69f762

File tree

10 files changed

+557
-677
lines changed

10 files changed

+557
-677
lines changed

crates/ide_completion/src/completions/keyword.rs

+5-23
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
9292
}
9393

9494
if !ctx.has_visibility_prev_sibling()
95-
&& (expects_item || ctx.expects_non_trait_assoc_item() || ctx.expect_record_field())
95+
&& (expects_item || ctx.expects_non_trait_assoc_item() || ctx.expect_field())
9696
{
9797
add_keyword("pub(crate)", "pub(crate) ");
9898
add_keyword("pub", "pub ");
@@ -122,6 +122,10 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
122122
add_keyword("union", "union $1 {\n $0\n}");
123123
}
124124

125+
if ctx.expects_type() {
126+
return;
127+
}
128+
125129
if ctx.expects_expression() {
126130
if !has_block_expr_parent {
127131
add_keyword("unsafe", "unsafe {\n $0\n}");
@@ -372,28 +376,6 @@ fn quux() -> i32 {
372376
);
373377
}
374378

375-
#[test]
376-
fn test_mut_in_ref_and_in_fn_parameters_list() {
377-
check(
378-
r"fn my_fn(&$0) {}",
379-
expect![[r#"
380-
kw mut
381-
"#]],
382-
);
383-
check(
384-
r"fn my_fn($0) {}",
385-
expect![[r#"
386-
kw mut
387-
"#]],
388-
);
389-
check(
390-
r"fn my_fn() { let &$0 }",
391-
expect![[r#"
392-
kw mut
393-
"#]],
394-
);
395-
}
396-
397379
#[test]
398380
fn no_keyword_completion_in_comments() {
399381
cov_mark::check!(no_keyword_completion_in_comments);

0 commit comments

Comments
 (0)