From 76d6f54471b5026ff228a58f10c69256a4b931bc Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 25 Apr 2020 21:34:38 +0200 Subject: Don't add call parens when an fn type is expected --- crates/ra_hir/src/code_model.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 3f645a1dd..fb788736d 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -1136,6 +1136,13 @@ impl Type { matches!(&self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::Closure { .. }, .. })) } + pub fn is_fn(&self) -> bool { + matches!(&self.ty.value, + Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(..), .. }) | + Ty::Apply(ApplicationTy { ctor: TypeCtor::FnPtr { .. }, .. }) + ) + } + pub fn contains_unknown(&self) -> bool { return go(&self.ty.value); -- cgit v1.2.3