diff options
author | Florian Diebold <[email protected]> | 2018-12-29 11:08:57 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-29 11:08:57 +0000 |
commit | b1590bdf6a88c03e2aeeedbe04f4dbc4203073db (patch) | |
tree | ea6733ad05e79e93912924cc3725ab3fe96c83b3 /crates/ra_hir/src/ty.rs | |
parent | cfa1de72ebb7060a82dbf7a67432047d9ea2288a (diff) |
Missing return type means unit, not unknown
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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<Ty> { | |||
381 | .collect() | 381 | .collect() |
382 | }) | 382 | }) |
383 | .unwrap_or_else(|| Ok(Vec::new()))?; | 383 | .unwrap_or_else(|| Ok(Vec::new()))?; |
384 | let output = Ty::from_ast_opt(db, &module, node.ret_type().and_then(|rt| rt.type_ref()))?; | 384 | let output = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) { |
385 | Ty::from_ast(db, &module, type_ref)? | ||
386 | } else { | ||
387 | Ty::unit() | ||
388 | }; | ||
385 | let sig = FnSig { input, output }; | 389 | let sig = FnSig { input, output }; |
386 | Ok(Ty::FnPtr(Arc::new(sig))) | 390 | Ok(Ty::FnPtr(Arc::new(sig))) |
387 | } | 391 | } |