diff options
author | Florian Diebold <[email protected]> | 2018-12-25 14:15:40 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-25 14:27:15 +0000 |
commit | ab0b63992be0cec4999810096a53b40f63f90349 (patch) | |
tree | 5e6dca70c4e842bc87e6e1287cca176031ecc92f /crates/ra_hir/src/ty.rs | |
parent | 0d724ea572a5dd26acbbf2eb4538eabe454fb894 (diff) |
Implement basic completion for fields
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index f931f3c87..83da13f1a 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -574,7 +574,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
574 | match receiver_ty { | 574 | match receiver_ty { |
575 | Ty::Tuple(fields) => { | 575 | Ty::Tuple(fields) => { |
576 | let i = text.parse::<usize>().ok(); | 576 | let i = text.parse::<usize>().ok(); |
577 | i.and_then(|i| fields.get(i).cloned()).unwrap_or(Ty::Unknown) | 577 | i.and_then(|i| fields.get(i).cloned()) |
578 | .unwrap_or(Ty::Unknown) | ||
578 | } | 579 | } |
579 | Ty::Adt { def_id, .. } => { | 580 | Ty::Adt { def_id, .. } => { |
580 | let field_ty = match def_id.resolve(self.db)? { | 581 | let field_ty = match def_id.resolve(self.db)? { |
@@ -589,7 +590,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
589 | } else { | 590 | } else { |
590 | Ty::Unknown | 591 | Ty::Unknown |
591 | } | 592 | } |
592 | }, | 593 | } |
593 | ast::Expr::TryExpr(e) => { | 594 | ast::Expr::TryExpr(e) => { |
594 | let _inner_ty = if let Some(e) = e.expr() { | 595 | let _inner_ty = if let Some(e) = e.expr() { |
595 | self.infer_expr(e)? | 596 | self.infer_expr(e)? |