rust-lang/rustc_codegen_gcc

Improve iterator for files suppression

GuillaumeGomez opened this issue · 1 comments

In build_system/test.rs we currently have:

        for path in files
            .iter()
            .enumerate()
            .filter(|(pos, _)| *pos < start || *pos >= end)
            .map(|(_, path)| path)
        {
            remove_file(&rust_path.join(path))?;
        }

It would probably be simpler to use skip and take.

Hello, I tried to look at this and thought that it should be simple. but can you actually use skip and take here? The filter yields some element from the beginning and possibly some from the end, I cannot think of a combination of skip and take that would achieve the same result.