diff options
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 8 | ||||
| -rw-r--r-- | src/librustc_errors/lib.rs | 5 |
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, }) |
