pub fn simplify(self) -> Self {
        let files = self
            .files
            .into_iter()
            .filter_map(|s| match s {
                SourceFile::Group(group) => {
                    let group = group.simplify();

                    // Discard empty groups.
                    if group.files.is_empty() {
                        return None;
                    }

                    // Drop groups with only one file.
                    if group.files.len() == 1
                        && group.include_dirs.is_empty()
                        && group.defines.is_empty()
                        && group.target.is_wildcard()
                        && group.package.is_none()
                    {
                        return Some(group.files.into_iter().next().unwrap());
                    }

                    // Preserve the rest.
                    Some(SourceFile::Group(Box::new(group)))
                }
                other => Some(other),
            })
            .collect();
        SourceGroup {
            files: files,
            ..self
        }
    }
/// Simplify the source group. Removes empty subgroups and inlines subgroups
/// with the same configuration.
Simplify the source group. Removes empty subgroups and inlines subgroups
with the same configuration.
Simplify the source group . Removes empty subgroups and inlines subgroups with the same configuration .
pub fn simplify(self) -> Self {
        let files = self
            .files
            .into_iter()
            .filter_map(|s| match s {
                SourceFile::Group(group) => {
                    let group = group.simplify();
                    // Discard empty groups.
                    if group.files.is_empty() {
                        return None;
                    }
                    // Drop groups with only one file.
                    if group.files.len() == 1
                        && group.include_dirs.is_empty()
                        && group.defines.is_empty()
                        && group.target.is_wildcard()
                        && group.package.is_none()
                    {
                        return Some(group.files.into_iter().next().unwrap());
                    }
                    // Preserve the rest.
                    Some(SourceFile::Group(Box::new(group)))
                }
                other => Some(other),
            })
            .collect();
        SourceGroup {
            files: files,
            ..self
        }
    }
pub fn simplify ( self ) -> Self { let files = self . files . into_iter ( ) . filter_map ( | s | match s { SourceFile :: Group ( group ) => { let group = group . simplify ( ) ; // Discard empty groups. if group . files . is_empty ( ) { return None ; } // Drop groups with only one file. if group . files . len ( ) == 1 && group . include_dirs . is_empty ( ) && group . defines . is_empty ( ) && group . target . is_wildcard ( ) && group . package . is_none ( ) { return Some ( group . files . into_iter ( ) . next ( ) . unwrap ( ) ) ; } // Preserve the rest. Some ( SourceFile :: Group ( Box :: new ( group ) ) ) } other => Some ( other ) , } ) . collect ( ) ; SourceGroup { files : files , .. self } }
Simplify the source group.
Simplify the source group .
self
self