about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-29 06:32:24 +0000
committerbors <bors@rust-lang.org>2018-07-29 06:32:24 +0000
commita5c2d0fffaaf0b764c01bc4066e51ffd475ceae9 (patch)
tree5255142d5e3a48744db52d110ca90950724d69a9 /src/librustc_errors
parentfb0653e40289eecf32f3fac1e84fc69b815ce5cb (diff)
parente995a91a314da7df85f5471cbc621874b5d42b53 (diff)
downloadrust-a5c2d0fffaaf0b764c01bc4066e51ffd475ceae9.tar.gz
rust-a5c2d0fffaaf0b764c01bc4066e51ffd475ceae9.zip
Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakis
Misc cleanups
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs8
-rw-r--r--src/librustc_errors/lib.rs5
2 files changed, 4 insertions, 9 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index f54626d6a20..09295e2c7ff 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::<Vec<_>>().len() == 0
-        {
+        if line.annotations.iter().all(|a| a.is_line()) {
             return vec![];
         }
 
@@ -901,9 +899,7 @@ impl EmitterWriter {
         //    |  |   length of label
         //    |  magic `3`
         //    `max_line_num_len`
-        let padding = (0..padding + label.len() + 5)
-            .map(|_| " ")
-            .collect::<String>();
+        let padding = " ".repeat(padding + label.len() + 5);
 
         /// Return whether `style`, or the override if present and the style is `NoStyle`.
         fn style_or_override(style: Style, override_style: Option<Style>) -> Style {
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 67d2aa4d770..82546747755 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -608,9 +608,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,
                                              })