mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Fix panic in tuple fields
This commit is contained in:
parent
8f1792fde2
commit
4d66f5d7d2
1 changed files with 4 additions and 1 deletions
|
@ -93,7 +93,10 @@ impl AsName for ast::FieldKind {
|
|||
fn as_name(&self) -> Name {
|
||||
match self {
|
||||
ast::FieldKind::Name(nr) => nr.as_name(),
|
||||
ast::FieldKind::Index(idx) => Name::new_tuple_field(idx.text().parse().unwrap()),
|
||||
ast::FieldKind::Index(idx) => {
|
||||
let idx = idx.text().parse::<usize>().unwrap_or(0);
|
||||
Name::new_tuple_field(idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue