fn dedup_ch_masks(course_head_masks: &[CourseHeadMask]) -> Result<Vec<CourseHeadMask>> {
    let mut deduped_ch_masks = Vec::with_capacity(course_head_masks.len());
    'outer: for (i, ch_mask) in course_head_masks.iter().enumerate() {
        // Look for another CH mask who's matched CHs are a superset of `mask`
        for (other_i, other_ch_mask) in course_head_masks.iter().enumerate() {
            if i == other_i {
                continue; // Don't compare masks against themselves
            }
            if ch_mask.mask().is_subset_of(other_ch_mask.mask()) {
                continue 'outer; // Skip this `ch_mask` if it is implied by another mask
            }
        }
        deduped_ch_masks.push(ch_mask.clone());
    }
    Ok(deduped_ch_masks)
}
/// Remove course head masks which are an exact subset of another mask.  E.g. if `1xxx5678` and
/// `1xxxxx78` are both defined, then `1xxx5678` can be removed (assuming they both specify the
/// same calling bell).  It is an error if two masks are compatible but specify different calling
/// bells.
Remove course head masks which are an exact subset of another mask.
Remove course head masks which are an exact subset of another mask .
fn dedup_ch_masks(course_head_masks: &[CourseHeadMask]) -> Result<Vec<CourseHeadMask>> {
    let mut deduped_ch_masks = Vec::with_capacity(course_head_masks.len());
    'outer: for (i, ch_mask) in course_head_masks.iter().enumerate() {
        // Look for another CH mask who's matched CHs are a superset of `mask`
        for (other_i, other_ch_mask) in course_head_masks.iter().enumerate() {
            if i == other_i {
                continue; // Don't compare masks against themselves
            }
            if ch_mask.mask().is_subset_of(other_ch_mask.mask()) {
                continue 'outer; // Skip this `ch_mask` if it is implied by another mask
            }
        }
        deduped_ch_masks.push(ch_mask.clone());
    }
    Ok(deduped_ch_masks)
}
fn dedup_ch_masks ( course_head_masks : & [ CourseHeadMask ] ) -> Result < Vec < CourseHeadMask > > { let mut deduped_ch_masks = Vec :: with_capacity ( course_head_masks . len ( ) ) ; ' outer : for ( i , ch_mask ) in course_head_masks . iter ( ) . enumerate ( ) { // Look for another CH mask who's matched CHs are a superset of `mask` for ( other_i , other_ch_mask ) in course_head_masks . iter ( ) . enumerate ( ) { if i == other_i { continue ; // Don't compare masks against themselves } if ch_mask . mask ( ) . is_subset_of ( other_ch_mask . mask ( ) ) { continue ' outer ; // Skip this `ch_mask` if it is implied by another mask } } deduped_ch_masks . push ( ch_mask . clone ( ) ) ; } Ok ( deduped_ch_masks ) }
Remove course head masks which are an exact subset of another mask.
Remove course head masks which are an exact subset of another mask .
course_head_masks
&[CourseHeadMask]
course_head_masks
&[CourseHeadMask]