aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-25 21:30:50 +0100
committerGitHub <[email protected]>2020-04-25 21:30:50 +0100
commitfe99a29ad1226dd3f6801ea4bdb575506324be07 (patch)
tree4294c94e11a4ac689c13e2a3699d3c1aad8c94a3 /crates/ra_hir/src
parent45832b990c7f291abe578dff3c460f4a1232f024 (diff)
parent5a355ff52bc3f05e13a1c675290781da68289bc4 (diff)
Merge #4146
4146: Don't add call parens when an fn type is expected r=matklad a=jonas-schievink This is pretty useful when dealing with callback- or fn-pointer-heavy FFI code, as I have recently. Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs7
1 files changed, 7 insertions, 0 deletions
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 {
1136 matches!(&self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::Closure { .. }, .. })) 1136 matches!(&self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::Closure { .. }, .. }))
1137 } 1137 }
1138 1138
1139 pub fn is_fn(&self) -> bool {
1140 matches!(&self.ty.value,
1141 Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(..), .. }) |
1142 Ty::Apply(ApplicationTy { ctor: TypeCtor::FnPtr { .. }, .. })
1143 )
1144 }
1145
1139 pub fn contains_unknown(&self) -> bool { 1146 pub fn contains_unknown(&self) -> bool {
1140 return go(&self.ty.value); 1147 return go(&self.ty.value);
1141 1148