Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors

minor code cleanups

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2022-12-13 01:17:10 +01:00 committed by GitHub
commit 2707801858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 20 deletions

View file

@ -806,7 +806,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"
);

View file

@ -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::<Vec<_>>();
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() {