Skip to content

Commit

Permalink
drive by fix needless allocation of const string number
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Jun 12, 2022
1 parent 169231c commit 072112e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,12 @@ impl EmitterWriter {
self
}

fn maybe_anonymized(&self, line_num: usize) -> String {
if self.ui_testing { ANONYMIZED_LINE_NUM.to_string() } else { line_num.to_string() }
fn maybe_anonymized(&self, line_num: usize) -> Cow<'static, str> {
if self.ui_testing {
Cow::Borrowed(ANONYMIZED_LINE_NUM)
} else {
Cow::Owned(line_num.to_string())
}
}

fn draw_line(
Expand Down

0 comments on commit 072112e

Please sign in to comment.