mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
wrap_return_type_in_result works on the HIR
This commit is contained in:
parent
3770fce086
commit
26dd0c4e5b
2 changed files with 90 additions and 99 deletions
|
@ -122,6 +122,10 @@ impl FamousDefs<'_, '_> {
|
|||
self.find_enum("core:option:Option")
|
||||
}
|
||||
|
||||
pub fn core_result_Result(&self) -> Option<Enum> {
|
||||
self.find_enum("core:result:Result")
|
||||
}
|
||||
|
||||
pub fn core_default_Default(&self) -> Option<Trait> {
|
||||
self.find_trait("core:default:Default")
|
||||
}
|
||||
|
@ -206,6 +210,7 @@ impl SnippetCap {
|
|||
}
|
||||
|
||||
/// Calls `cb` on each expression inside `expr` that is at "tail position".
|
||||
/// Does not walk into `break` or `return` expressions.
|
||||
pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
|
||||
match expr {
|
||||
ast::Expr::BlockExpr(b) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue