Repository: sharkdp/bat
File: src/controller.rs (Rust)

Code before:
            });
            if !call_pager {
                paging_mode = PagingMode::Never;
            }
        }

        let mut output_type = OutputType::from_mode(paging_mode, self.config.pager)?;
        let writer = output_type.handle()?;
        let mut no_errors: bool = true;

        let stdin = io::stdin();

        let filenames = if self.config.filenames.is_none() {
            vec![None; self.config.files.len()]
        } else {
            self.config
                .filenames
                .as_ref()
                .unwrap()
                .into_iter()
                .map(|name| Some(*name))
                .collect()
        };

        for it in self.config.files.iter().zip(filenames) {
            let (input_file, file_name) = it;
            match input_file.get_reader(&stdin) {
                Err(error) => {
                    handle_error(&error);
                    no_errors = false;
                }
                Ok(mut reader) => {
                    let result = if self.config.loop_through {
                        let mut printer = SimplePrinter::new();
                        self.print_file(reader, &mut printer, writer, *input_file, file_name)
                    } else {
                        let mut printer = InteractivePrinter::new(
                            &self.config,
                            &self.assets,
                            *input_file,
                            &mut reader,
                        );
                        self.print_file(reader, &mut printer, writer, *input_file, file_name)
                    };

                    if let Err(error) = result {
                        handle_error(&error);
                        no_errors = false;
                    }
                }
            }

Review comment (suggestion):
You can use:
``` rust
for (input_file, file_name) in self.config.files.iter().zip(filenames) {
```

Code after:
            });
            if !call_pager {
                paging_mode = PagingMode::Never;
            }
        }

        let mut output_type = OutputType::from_mode(paging_mode, self.config.pager)?;
        let writer = output_type.handle()?;
        let mut no_errors: bool = true;

        let stdin = io::stdin();

        let filenames: Box<dyn Iterator<Item = _>> = match self.config.filenames {
            Some(ref filenames) => Box::new(filenames.into_iter().map(|name| Some(*name))),
            None => Box::new(std::iter::repeat(None)),
        };

        for (input_file, file_name) in self.config.files.iter().zip(filenames) {
            match input_file.get_reader(&stdin) {
                Err(error) => {
                    handle_error(&error);
                    no_errors = false;
                }
                Ok(mut reader) => {
                    let result = if self.config.loop_through {
                        let mut printer = SimplePrinter::new();
                        self.print_file(reader, &mut printer, writer, *input_file, file_name)
                    } else {
                        let mut printer = InteractivePrinter::new(
                            &self.config,
                            &self.assets,
                            *input_file,
                            &mut reader,
                        );
                        self.print_file(reader, &mut printer, writer, *input_file, file_name)
                    };

                    if let Err(error) = result {
                        handle_error(&error);
                        no_errors = false;
                    }
                }
            }
        }

        Ok(no_errors)
    }

    fn print_file<'a, P: Printer>(
        &self,
        reader: InputFileReader,