Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/chalk_ext.rs')
| -rw-r--r-- | crates/hir_ty/src/chalk_ext.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/hir_ty/src/chalk_ext.rs b/crates/hir_ty/src/chalk_ext.rs index c29fbd688a..36c56820eb 100644 --- a/crates/hir_ty/src/chalk_ext.rs +++ b/crates/hir_ty/src/chalk_ext.rs @@ -104,10 +104,9 @@ impl TyExt for Ty { } fn as_fn_def(&self, db: &dyn HirDatabase) -> Option<FunctionId> { - if let Some(CallableDefId::FunctionId(func)) = self.callable_def(db) { - Some(func) - } else { - None + match self.callable_def(db) { + Some(CallableDefId::FunctionId(func)) => Some(func), + Some(CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_)) | None => None, } } fn as_reference(&self) -> Option<(&Ty, Lifetime, Mutability)> { |