diff options
author | Aleksey Kladov <[email protected]> | 2020-01-07 13:49:42 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-01-07 13:49:42 +0000 |
commit | 4d66f5d7d2355ce82aec0b41b4b94a1d7f2d9c1c (patch) | |
tree | 4f71a0d17da6b4fd71bf84454f9620c77e6a5366 | |
parent | 8f1792fde233799fe3335032834ee7281d78e55b (diff) |
Fix panic in tuple fields
-rw-r--r-- | crates/ra_hir_expand/src/name.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs index e62693b68..b3fa1efba 100644 --- a/crates/ra_hir_expand/src/name.rs +++ b/crates/ra_hir_expand/src/name.rs | |||
@@ -93,7 +93,10 @@ impl AsName for ast::FieldKind { | |||
93 | fn as_name(&self) -> Name { | 93 | fn as_name(&self) -> Name { |
94 | match self { | 94 | match self { |
95 | ast::FieldKind::Name(nr) => nr.as_name(), | 95 | ast::FieldKind::Name(nr) => nr.as_name(), |
96 | ast::FieldKind::Index(idx) => Name::new_tuple_field(idx.text().parse().unwrap()), | 96 | ast::FieldKind::Index(idx) => { |
97 | let idx = idx.text().parse::<usize>().unwrap_or(0); | ||
98 | Name::new_tuple_field(idx) | ||
99 | } | ||
97 | } | 100 | } |
98 | } | 101 | } |
99 | } | 102 | } |