Skip to content

Commit 36d705e

Browse files
committed
Use resolve_method_call_as_callable to handle function types
1 parent 7f3601f commit 36d705e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tools/rust-analyzer/crates/ide/src/goto_definition.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ fn find_definition_for_known_blanket_dual_impls(
145145
// - return_type is B (type of b)
146146
// We will find the definition of B::from(a: A).
147147
let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
148-
let receiver_type = sema.type_of_expr(&method_call.receiver()?)?.adjusted();
149-
let return_type = sema.type_of_expr(&method_call.clone().into())?.original();
148+
let callable = sema.resolve_method_call_as_callable(&method_call)?;
149+
let (_, receiver_type) = callable.receiver_param(db)?;
150+
let return_type = callable.return_type();
150151

151152
let (search_method, search_trait, return_type) = match method_call.name_ref()?.text().as_str() {
152153
"into" => ("from", FamousDefs(sema, krate).core_convert_From()?, return_type),

0 commit comments

Comments
 (0)