Skip to content

Commit

Permalink
Use builtin_index instead of match
Browse files Browse the repository at this point in the history
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
  • Loading branch information
cbeuw and oli-obk committed Mar 20, 2023
1 parent e24f5ac commit f404f33
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,9 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
)
),
ExprKind::Array { fields } => {
let elem_ty = match expr.ty.kind() {
ty::Array(ty, ..) => ty,
_ => unreachable!("ty is array"),
};
let elem_ty = expr.ty.builtin_index().expect("ty must be an array");
Ok(Rvalue::Aggregate(
Box::new(AggregateKind::Array(*elem_ty)),
Box::new(AggregateKind::Array(elem_ty)),
fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()?
))
},
Expand Down

0 comments on commit f404f33

Please sign in to comment.