diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-16 17:50:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-16 17:50:37 +0100 |
commit | 081596dd584ac39fbfa6a7e47dfe9dd4a58c362a (patch) | |
tree | b6d564a63068530ef3aabb8855699bf20c45a608 /crates/ra_ide/src/inlay_hints.rs | |
parent | 9210fcc076808e53e9bde84be26307fc0dc7d688 (diff) | |
parent | e1e79cf0648624e7a3787d0013c0c7e86210772f (diff) |
Merge #5413
5413: Semantical call info r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/inlay_hints.rs')
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 3cbae8a45..ae5695f61 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -5,10 +5,10 @@ use ra_syntax::{ | |||
5 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, | 5 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, |
6 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, | 6 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, |
7 | }; | 7 | }; |
8 | |||
9 | use crate::{FileId, FunctionSignature}; | ||
10 | use stdx::to_lower_snake_case; | 8 | use stdx::to_lower_snake_case; |
11 | 9 | ||
10 | use crate::{display::function_signature::FunctionSignature, FileId}; | ||
11 | |||
12 | #[derive(Clone, Debug, PartialEq, Eq)] | 12 | #[derive(Clone, Debug, PartialEq, Eq)] |
13 | pub struct InlayHintsConfig { | 13 | pub struct InlayHintsConfig { |
14 | pub type_hints: bool, | 14 | pub type_hints: bool, |
@@ -322,15 +322,15 @@ fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option< | |||
322 | match expr { | 322 | match expr { |
323 | ast::Expr::CallExpr(expr) => { | 323 | ast::Expr::CallExpr(expr) => { |
324 | // FIXME: Type::as_callable is broken for closures | 324 | // FIXME: Type::as_callable is broken for closures |
325 | let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?; | 325 | let callable = sema.type_of_expr(&expr.expr()?)?.as_callable(sema.db)?; |
326 | match callable_def { | 326 | match callable.kind() { |
327 | hir::CallableDefId::FunctionId(it) => { | 327 | hir::CallableKind::Function(it) => { |
328 | Some(FunctionSignature::from_hir(sema.db, it.into())) | 328 | Some(FunctionSignature::from_hir(sema.db, it.into())) |
329 | } | 329 | } |
330 | hir::CallableDefId::StructId(it) => { | 330 | hir::CallableKind::TupleStruct(it) => { |
331 | FunctionSignature::from_struct(sema.db, it.into()) | 331 | FunctionSignature::from_struct(sema.db, it.into()) |
332 | } | 332 | } |
333 | hir::CallableDefId::EnumVariantId(it) => { | 333 | hir::CallableKind::TupleEnumVariant(it) => { |
334 | FunctionSignature::from_enum_variant(sema.db, it.into()) | 334 | FunctionSignature::from_enum_variant(sema.db, it.into()) |
335 | } | 335 | } |
336 | } | 336 | } |