1
Fork 0

Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakis

Misc cleanups
This commit is contained in:
bors 2018-07-29 06:32:24 +00:00
commit a5c2d0fffa
20 changed files with 50 additions and 73 deletions

View file

@ -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 {

View file

@ -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,
})