diff --git a/src/commands/input.rs b/src/commands/input.rs index c9ea724369..199242ab85 100644 --- a/src/commands/input.rs +++ b/src/commands/input.rs @@ -328,7 +328,10 @@ impl InputPath { Ok(Self { files }) } - pub fn files(&self) -> &[PathBuf] { - &self.files + pub fn input_readers(&self) -> impl Iterator> + '_ { + self.files + .iter() + .rev() + .map(|p| InputReader::new(&p.to_string_lossy())) } } diff --git a/src/commands/stats.rs b/src/commands/stats.rs index 564534fb21..f524bfe8fb 100644 --- a/src/commands/stats.rs +++ b/src/commands/stats.rs @@ -49,12 +49,7 @@ pub async fn stats(config: &StatsConfig) -> Result<()> { let mut builder = FileSetStatsBuilder::default(); - for input_reader in input_path - .files() - .iter() - .rev() - .map(|p| InputReader::new(&p.to_string_lossy())) - { + for input_reader in input_path.input_readers() { let input_reader = input_reader.context(OpenInput)?; let file_stats = stats_for_file(config, input_reader).await?;