11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2022-03-19 19:26:34 +00:00 committed by GitHub
commit a82caff588
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -344,12 +344,12 @@ fn closure_ret_hints(
return None;
}
let closure = sema.descend_node_into_attributes(closure.clone()).pop()?;
let param_list = match closure.body() {
Some(ast::Expr::BlockExpr(_)) => closure.param_list()?,
_ => return None,
};
let closure = sema.descend_node_into_attributes(closure.clone()).pop()?;
let ty = sema.type_of_expr(&ast::Expr::ClosureExpr(closure))?.adjusted();
let callable = ty.as_callable(sema.db)?;
let ty = callable.return_type();