diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-04-10 14:13:16 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-10 14:13:16 +0530 |
| commit | 97921abc068224b29a5b2305f7e69c702ff9e38f (patch) | |
| tree | cbd5c2fd6cd05fb87eeac8f6af9611b632eb639c /compiler/rustc_errors/src | |
| parent | 6f2fd3e6a21e922f4f2d26b47d894da2f8fdc61b (diff) | |
| parent | 9fc1555f74f96fd1f77d5188fe438abd1c6f72d9 (diff) | |
| download | rust-97921abc068224b29a5b2305f7e69c702ff9e38f.tar.gz rust-97921abc068224b29a5b2305f7e69c702ff9e38f.zip | |
Rollup merge of #110124 - Nilstrieb:📎-told-me-so, r=compiler-errors
Some clippy fixes in the compiler Best reviewed commit-by-commit 📎.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 9ed8ab67431..e09ef34b93d 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -956,7 +956,7 @@ impl Diagnostic { // Exact iteration order of diagnostic arguments shouldn't make a difference to output because // they're only used in interpolation. #[allow(rustc::potential_query_instability)] - pub fn args<'a>(&'a self) -> impl Iterator<Item = DiagnosticArg<'a, 'static>> { + pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_, 'static>> { self.args.iter() } diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 4b1ff0e1df9..81e8bcbf7cd 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1407,7 +1407,7 @@ impl EmitterWriter { // Account for newlines to align output to its label. for (line, text) in normalize_whitespace(&text).lines().enumerate() { buffer.append( - 0 + line, + line, &format!( "{}{}", if line == 0 { String::new() } else { " ".repeat(label_width) }, @@ -1918,7 +1918,7 @@ impl EmitterWriter { let last_line = unhighlighted_lines.pop(); let first_line = unhighlighted_lines.drain(..).next(); - first_line.map(|(p, l)| { + if let Some((p, l)) = first_line { self.draw_code_line( &mut buffer, &mut row_num, @@ -1930,12 +1930,12 @@ impl EmitterWriter { &file_lines, is_multiline, ) - }); + } buffer.puts(row_num, max_line_num_len - 1, "...", Style::LineNumber); row_num += 1; - last_line.map(|(p, l)| { + if let Some((p, l)) = last_line { self.draw_code_line( &mut buffer, &mut row_num, @@ -1947,7 +1947,7 @@ impl EmitterWriter { &file_lines, is_multiline, ) - }); + } } } |
