From 2ea368e53c755fb13d3ad5cd59370a3f7ad4e8c0 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Mon, 12 Dec 2022 19:49:53 +0100 Subject: minor code cleanups --- compiler/rustc_errors/src/diagnostic.rs | 2 +- compiler/rustc_errors/src/emitter.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 06bb5edc090..0f79bc558bf 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -802,7 +802,7 @@ impl Diagnostic { debug_assert!( !(suggestions .iter() - .flat_map(|suggs| suggs) + .flatten() .any(|(sp, suggestion)| sp.is_empty() && suggestion.is_empty())), "Span must not be empty and have no suggestion" ); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 4df2198fb0e..aaf0699f0dc 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1308,7 +1308,7 @@ impl EmitterWriter { // see how it *looks* with // very *weird* formats // see? - for &(ref text, ref style) in msg.iter() { + for (text, style) in msg.iter() { let text = self.translate_message(text, args); let lines = text.split('\n').collect::>(); if lines.len() > 1 { @@ -1370,7 +1370,7 @@ impl EmitterWriter { buffer.append(0, ": ", header_style); label_width += 2; } - for &(ref text, _) in msg.iter() { + for (text, _) in msg.iter() { let text = self.translate_message(text, args); // Account for newlines to align output to its label. for (line, text) in normalize_whitespace(&text).lines().enumerate() { -- cgit 1.4.1-3-g733a5