mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Only complete type annotations for patterns in function params
This commit is contained in:
parent
d07f4e4c35
commit
bf918046fa
5 changed files with 67 additions and 19 deletions
|
@ -309,3 +309,41 @@ fn outer(Foo { bar$0 }: Foo) {}
|
|||
expect![[r#""#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_in_fn_param() {
|
||||
check_empty(
|
||||
r#"
|
||||
struct Foo { bar: Bar }
|
||||
struct Bar(u32);
|
||||
fn foo($0) {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw mut
|
||||
bn Foo Foo { bar$1 }: Foo$0
|
||||
st Foo
|
||||
bn Bar Bar($1): Bar$0
|
||||
st Bar
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_in_closure_param() {
|
||||
check_empty(
|
||||
r#"
|
||||
struct Foo { bar: Bar }
|
||||
struct Bar(u32);
|
||||
fn foo() {
|
||||
|$0| {};
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw mut
|
||||
bn Foo Foo { bar$1 }$0
|
||||
st Foo
|
||||
bn Bar Bar($1)$0
|
||||
st Bar
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue