aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/call_info.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/call_info.rs')
-rw-r--r--crates/ra_ide/src/call_info.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs
index 35a8a0dc5..53d56a0a4 100644
--- a/crates/ra_ide/src/call_info.rs
+++ b/crates/ra_ide/src/call_info.rs
@@ -70,6 +70,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
70 variant.name(db) 70 variant.name(db)
71 ); 71 );
72 } 72 }
73 hir::CallableKind::Closure => (),
73 } 74 }
74 75
75 res.signature.push('('); 76 res.signature.push('(');
@@ -93,7 +94,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
93 res.signature.push(')'); 94 res.signature.push(')');
94 95
95 match callable.kind() { 96 match callable.kind() {
96 hir::CallableKind::Function(_) => { 97 hir::CallableKind::Function(_) | hir::CallableKind::Closure => {
97 let ret_type = callable.return_type(); 98 let ret_type = callable.return_type();
98 if !ret_type.is_unit() { 99 if !ret_type.is_unit() {
99 format_to!(res.signature, " -> {}", ret_type.display(db)); 100 format_to!(res.signature, " -> {}", ret_type.display(db));
@@ -702,4 +703,21 @@ id! {
702 "#]], 703 "#]],
703 ); 704 );
704 } 705 }
706
707 #[test]
708 fn call_info_for_lambdas() {
709 check(
710 r#"
711struct S;
712fn foo(s: S) -> i32 { 92 }
713fn main() {
714 (|s| foo(s))(<|>)
715}
716 "#,
717 expect![[r#"
718 (S) -> i32
719 (<S>)
720 "#]],
721 )
722 }
705} 723}