diff options
author | Florian Diebold <[email protected]> | 2019-05-12 17:33:47 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-06-15 17:21:23 +0100 |
commit | 9c5e7dd849eff7bd6f20aa353feef083d089ff58 (patch) | |
tree | 5639ff8814d3f4ba0f5ac41de215ed3720f3d1b9 /crates/ra_assists/src | |
parent | 49489dc20cc9f340d43acb467677b9bc59495ed2 (diff) |
Implement autoderef using the Deref trait
- add support for other lang item targets, since we need the Deref lang item
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/fill_match_arms.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs index a7de6ae9f..c7a8bce20 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/fill_match_arms.rs | |||
@@ -22,7 +22,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As | |||
22 | let expr = match_expr.expr()?; | 22 | let expr = match_expr.expr()?; |
23 | let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None); | 23 | let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None); |
24 | let match_expr_ty = analyzer.type_of(ctx.db, expr)?; | 24 | let match_expr_ty = analyzer.type_of(ctx.db, expr)?; |
25 | let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() { | 25 | let enum_def = analyzer.autoderef(ctx.db, match_expr_ty).find_map(|ty| match ty.as_adt() { |
26 | Some((AdtDef::Enum(e), _)) => Some(e), | 26 | Some((AdtDef::Enum(e), _)) => Some(e), |
27 | _ => None, | 27 | _ => None, |
28 | })?; | 28 | })?; |