mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Fix panic in tuple fields
This commit is contained in:
parent
8f1792fde2
commit
4d66f5d7d2
@ -93,7 +93,10 @@ impl AsName for ast::FieldKind {
|
|||||||
fn as_name(&self) -> Name {
|
fn as_name(&self) -> Name {
|
||||||
match self {
|
match self {
|
||||||
ast::FieldKind::Name(nr) => nr.as_name(),
|
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…
x
Reference in New Issue
Block a user