mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Merge #11218
11218: fix: Correct has_ref detection, avoiding duplicate &mut insertion on parameter completion r=Veykril a=weirane The original code fails to detect there's a ref in scenarios such as `&mut s` and `& s` because `WHITESPACE` and `IDENT` got reversed. Closes #11199. Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
This commit is contained in:
commit
2fb6f5e46a
2 changed files with 31 additions and 1 deletions
|
@ -1151,6 +1151,22 @@ fn main() {
|
|||
fn foo(…) []
|
||||
"#]],
|
||||
);
|
||||
check_relevance(
|
||||
r#"
|
||||
struct S;
|
||||
fn foo(s: &mut S) {}
|
||||
fn main() {
|
||||
let mut ssss = S;
|
||||
foo(&mut s$0);
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
lc ssss [type+local]
|
||||
st S []
|
||||
fn main() []
|
||||
fn foo(…) []
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue