pub(crate) fn cleanup_removed_measurements(module: &mut Module, removed_items: &HashSet<String>) {
    if removed_items.is_empty() {
        return;
    }

    for group in &mut module.group {
        if let Some(ref_measurement) = &mut group.ref_measurement {
            cleanup_item_list(&mut ref_measurement.identifier_list, removed_items);
            if ref_measurement.identifier_list.is_empty() {
                group.ref_measurement = None;
            }
        }
    }

    for function in &mut module.function {
        if let Some(in_measurement) = &mut function.in_measurement {
            cleanup_item_list(&mut in_measurement.identifier_list, removed_items);
            if in_measurement.identifier_list.is_empty() {
                function.in_measurement = None;
            }
        }
        if let Some(loc_measurement) = &mut function.loc_measurement {
            cleanup_item_list(&mut loc_measurement.identifier_list, removed_items);
            if loc_measurement.identifier_list.is_empty() {
                function.loc_measurement = None;
            }
        }
        if let Some(out_measurement) = &mut function.out_measurement {
            cleanup_item_list(&mut out_measurement.identifier_list, removed_items);
            if out_measurement.identifier_list.is_empty() {
                function.out_measurement = None;
            }
        }
    }

    for characteristic in &mut module.characteristic {
        for axis_descr in &mut characteristic.axis_descr {
            if removed_items.get(&axis_descr.input_quantity).is_some() {
                axis_descr.input_quantity = "NO_INPUT_QUANTITY".to_string();
            }
        }

        if let Some(comparison_quantity) = &characteristic.comparison_quantity {
            if removed_items.get(&comparison_quantity.name).is_some() {
                characteristic.comparison_quantity = None;
            }
        }
    }

    for typedef_characteristic in &mut module.typedef_characteristic {
        for axis_descr in &mut typedef_characteristic.axis_descr {
            if removed_items.get(&axis_descr.input_quantity).is_some() {
                axis_descr.input_quantity = "NO_INPUT_QUANTITY".to_string();
            }
        }
    }

    for axis_pts in &mut module.axis_pts {
        if removed_items.get(&axis_pts.input_quantity).is_some() {
            axis_pts.input_quantity = "NO_INPUT_QUANTITY".to_string();
        }
    }

    for typedef_axis in &mut module.typedef_axis {
        if removed_items.get(&typedef_axis.input_quantity).is_some() {
            typedef_axis.input_quantity = "NO_INPUT_QUANTITY".to_string();
        }
    }
}
// when update runs without preserve some MEASUREMENTs could be removed
// these items should also be removed from the identifier lists in GROUPs, FUNCTIONs, etc
when update runs without preserve some MEASUREMENTs could be removed
these items should also be removed from the identifier lists in GROUPs, FUNCTIONs, etc
when update runs without preserve some MEASUREMENTs could be removed these items should also be removed from the identifier lists in GROUPs FUNCTIONs etc
pub(crate) fn cleanup_removed_measurements(module: &mut Module, removed_items: &HashSet<String>) {
    if removed_items.is_empty() {
        return;
    }
    for group in &mut module.group {
        if let Some(ref_measurement) = &mut group.ref_measurement {
            cleanup_item_list(&mut ref_measurement.identifier_list, removed_items);
            if ref_measurement.identifier_list.is_empty() {
                group.ref_measurement = None;
            }
        }
    }
    for function in &mut module.function {
        if let Some(in_measurement) = &mut function.in_measurement {
            cleanup_item_list(&mut in_measurement.identifier_list, removed_items);
            if in_measurement.identifier_list.is_empty() {
                function.in_measurement = None;
            }
        }
        if let Some(loc_measurement) = &mut function.loc_measurement {
            cleanup_item_list(&mut loc_measurement.identifier_list, removed_items);
            if loc_measurement.identifier_list.is_empty() {
                function.loc_measurement = None;
            }
        }
        if let Some(out_measurement) = &mut function.out_measurement {
            cleanup_item_list(&mut out_measurement.identifier_list, removed_items);
            if out_measurement.identifier_list.is_empty() {
                function.out_measurement = None;
            }
        }
    }
    for characteristic in &mut module.characteristic {
        for axis_descr in &mut characteristic.axis_descr {
            if removed_items.get(&axis_descr.input_quantity).is_some() {
                axis_descr.input_quantity = "NO_INPUT_QUANTITY".to_string();
            }
        }
        if let Some(comparison_quantity) = &characteristic.comparison_quantity {
            if removed_items.get(&comparison_quantity.name).is_some() {
                characteristic.comparison_quantity = None;
            }
        }
    }
    for typedef_characteristic in &mut module.typedef_characteristic {
        for axis_descr in &mut typedef_characteristic.axis_descr {
            if removed_items.get(&axis_descr.input_quantity).is_some() {
                axis_descr.input_quantity = "NO_INPUT_QUANTITY".to_string();
            }
        }
    }
    for axis_pts in &mut module.axis_pts {
        if removed_items.get(&axis_pts.input_quantity).is_some() {
            axis_pts.input_quantity = "NO_INPUT_QUANTITY".to_string();
        }
    }
    for typedef_axis in &mut module.typedef_axis {
        if removed_items.get(&typedef_axis.input_quantity).is_some() {
            typedef_axis.input_quantity = "NO_INPUT_QUANTITY".to_string();
        }
    }
}
pub ( crate ) fn cleanup_removed_measurements ( module : & mut Module , removed_items : & HashSet < String > ) { if removed_items . is_empty ( ) { return ; } for group in & mut module . group { if let Some ( ref_measurement ) = & mut group . ref_measurement { cleanup_item_list ( & mut ref_measurement . identifier_list , removed_items ) ; if ref_measurement . identifier_list . is_empty ( ) { group . ref_measurement = None ; } } } for function in & mut module . function { if let Some ( in_measurement ) = & mut function . in_measurement { cleanup_item_list ( & mut in_measurement . identifier_list , removed_items ) ; if in_measurement . identifier_list . is_empty ( ) { function . in_measurement = None ; } } if let Some ( loc_measurement ) = & mut function . loc_measurement { cleanup_item_list ( & mut loc_measurement . identifier_list , removed_items ) ; if loc_measurement . identifier_list . is_empty ( ) { function . loc_measurement = None ; } } if let Some ( out_measurement ) = & mut function . out_measurement { cleanup_item_list ( & mut out_measurement . identifier_list , removed_items ) ; if out_measurement . identifier_list . is_empty ( ) { function . out_measurement = None ; } } } for characteristic in & mut module . characteristic { for axis_descr in & mut characteristic . axis_descr { if removed_items . get ( & axis_descr . input_quantity ) . is_some ( ) { axis_descr . input_quantity = " " . to_string ( ) ; } } if let Some ( comparison_quantity ) = & characteristic . comparison_quantity { if removed_items . get ( & comparison_quantity . name ) . is_some ( ) { characteristic . comparison_quantity = None ; } } } for typedef_characteristic in & mut module . typedef_characteristic { for axis_descr in & mut typedef_characteristic . axis_descr { if removed_items . get ( & axis_descr . input_quantity ) . is_some ( ) { axis_descr . input_quantity = " " . to_string ( ) ; } } } for axis_pts in & mut module . axis_pts { if removed_items . get ( & axis_pts . input_quantity ) . is_some ( ) { axis_pts . input_quantity = " " . to_string ( ) ; } } for typedef_axis in & mut module . typedef_axis { if removed_items . get ( & typedef_axis . input_quantity ) . is_some ( ) { typedef_axis . input_quantity = " " . to_string ( ) ; } } }
when update runs without preserve some MEASUREMENTs could be removed
these items should also be removed from the identifier lists in GROUPs, FUNCTIONs, etc
when update runs without preserve some MEASUREMENTs could be removed these items should also be removed from the identifier lists in GROUPs FUNCTIONs etc
module
&mut Module
removed_items
&HashSet<String>