From 619a2906f850cb109ce8d59ea8863395c2ebe712 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Fri, 17 May 2019 07:41:25 +0200 Subject: [PATCH] Collect at callsite, use eprintln instead of println --- clippy_dev/src/stderr_length_check.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/clippy_dev/src/stderr_length_check.rs b/clippy_dev/src/stderr_length_check.rs index 9222ed84167b..6c5107aebfd3 100644 --- a/clippy_dev/src/stderr_length_check.rs +++ b/clippy_dev/src/stderr_length_check.rs @@ -11,10 +11,10 @@ const LIMIT: usize = 320; pub fn check() { let stderr_files = stderr_files(); - let exceeding_files = exceeding_stderr_files(stderr_files); + let exceeding_files = exceeding_stderr_files(stderr_files).collect::>(); if !exceeding_files.is_empty() { - println!("Error: stderr files exceeding limit of {} lines:", LIMIT); + eprintln!("Error: stderr files exceeding limit of {} lines:", LIMIT); for path in exceeding_files { println!("{}", path); } @@ -22,7 +22,7 @@ pub fn check() { } } -fn exceeding_stderr_files(files: impl Iterator) -> Vec { +fn exceeding_stderr_files(files: impl Iterator) -> impl Iterator { files .filter_map(|file| { let path = file.path().to_str().expect("Could not convert path to str").to_string(); @@ -33,7 +33,6 @@ fn exceeding_stderr_files(files: impl Iterator) -> Vec None } }) - .collect() } fn stderr_files() -> impl Iterator {