From 8296699faed63f713735fbfac53c0325ce45954e Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Fri, 16 Mar 2018 22:35:26 +0900 Subject: Remove unnecessary `.collect()` --- src/librustc_errors/emitter.rs | 4 +--- src/librustc_errors/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index a392278cab9..e0ed89a6416 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -528,9 +528,7 @@ impl EmitterWriter { // If there are no annotations or the only annotations on this line are // MultilineLine, then there's only code being shown, stop processing. - if line.annotations.is_empty() || line.annotations.iter() - .filter(|a| !a.is_line()).collect::>().len() == 0 - { + if line.annotations.iter().all(|a| a.is_line()) { return vec![]; } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index c0f07645f49..400e5829d33 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -610,9 +610,8 @@ impl Handler { if can_show_explain && are_there_diagnostics { let mut error_codes = self.emitted_diagnostic_codes.borrow() - .clone() - .into_iter() - .filter_map(|x| match x { + .iter() + .filter_map(|x| match *x { DiagnosticId::Error(ref s) => Some(s.clone()), _ => None, }) -- cgit 1.4.1-3-g733a5