From b1590bdf6a88c03e2aeeedbe04f4dbc4203073db Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 29 Dec 2018 12:08:57 +0100 Subject: Missing return type means unit, not unknown --- crates/ra_hir/src/ty.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/ty.rs') diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 0592e4a63..4ebd44d27 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -381,7 +381,11 @@ pub fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable { .collect() }) .unwrap_or_else(|| Ok(Vec::new()))?; - let output = Ty::from_ast_opt(db, &module, node.ret_type().and_then(|rt| rt.type_ref()))?; + let output = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) { + Ty::from_ast(db, &module, type_ref)? + } else { + Ty::unit() + }; let sig = FnSig { input, output }; Ok(Ty::FnPtr(Arc::new(sig))) } -- cgit v1.2.3