Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_completion/src/context.rs')
| -rw-r--r-- | crates/ide_completion/src/context.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index 2374d689cb..26f6c17805 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs @@ -904,7 +904,7 @@ fn path_or_use_tree_qualifier(path: &ast::Path) -> Option<(ast::Path, bool)> { fn has_ref(token: &SyntaxToken) -> bool { let mut token = token.clone(); - for skip in [WHITESPACE, IDENT, T![mut]] { + for skip in [IDENT, WHITESPACE, T![mut]] { if token.kind() == skip { token = match token.prev_token() { Some(it) => it, @@ -1025,6 +1025,20 @@ fn bar(x: &mut u32) {} ); check_expected_type_and_name( r#" +fn foo() { bar(& c$0); } +fn bar(x: &u32) {} + "#, + expect![[r#"ty: u32, name: x"#]], + ); + check_expected_type_and_name( + r#" +fn foo() { bar(&mut c$0); } +fn bar(x: &mut u32) {} +"#, + expect![[r#"ty: u32, name: x"#]], + ); + check_expected_type_and_name( + r#" fn foo() { bar(&c$0); } fn bar(x: &u32) {} "#, |