Replace index based for loop
This initially did a linear search within the loop so iterating over the collection wasn't possible. Now we need to use a hashmap anyways, so this can be simplified again.
This commit is contained in:
parent
22b51f50bb
commit
8077f10c27
|
@ -93,12 +93,7 @@ impl ParamUnits {
|
|||
.map(|(unit_id, (group_name, _))| (*group_name, unit_id as i32 + 1))
|
||||
.collect();
|
||||
|
||||
for unit_id in 0..groups_units.len() {
|
||||
// We'll do an index-based loop with some clones because here it doesn't matter much for
|
||||
// performance anyways and otherwise it's a bit difficult to keep the borrow checker
|
||||
// happy ehre
|
||||
let group_name = groups_units[unit_id].0;
|
||||
|
||||
for (group_name, unit) in &mut groups_units {
|
||||
// If the group name does not contain any slashes then the unit's parent should stay at
|
||||
// the root unit
|
||||
if let Some(sep_pos) = group_name.rfind('/') {
|
||||
|
@ -106,7 +101,7 @@ impl ParamUnits {
|
|||
let parent_unit_id = *vst3_unit_id_by_group_name
|
||||
.get(parent_group_name)
|
||||
.ok_or("Missing parent group")?;
|
||||
groups_units[unit_id].1.parent_id = parent_unit_id;
|
||||
unit.parent_id = parent_unit_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue