Skip to content

Commit

Permalink
Update naga/src/front/atomic_upgrade.rs
Browse files Browse the repository at this point in the history
Simplify struct member upgrade.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
  • Loading branch information
schell and jimblandy authored Dec 16, 2024
1 parent 01b89cf commit 2ba1be5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions naga/src/front/atomic_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,9 @@ impl UpgradeState<'_> {
stride,
},
TypeInner::Struct { ref members, span } => {
let index = field_indices.pop().ok_or(Error::UnexpectedEndOfIndices)?;
let mut new_members = vec![];
for (i, mut member) in members.clone().into_iter().enumerate() {
if i == index as usize {
member.ty = self.upgrade_type(member.ty, field_indices)?;
}
new_members.push(member);
}
let index = field_indices.pop().ok_or(Error::UnexpectedEndOfIndices)? as usize;
let mut new_members = members.clone();
new_members[index].ty = self.upgrade_type(new_members[index].ty, field_indices)?;

TypeInner::Struct {
members: new_members,
Expand Down

0 comments on commit 2ba1be5

Please sign in to comment.