Remove some unnecessary clone calls.

This commit is contained in:
Nicholas Nethercote 2024-02-02 09:19:22 +11:00
parent 8ba25d0989
commit df322fc29f
2 changed files with 4 additions and 6 deletions

View File

@ -1817,7 +1817,7 @@ impl Emitter for SharedEmitter {
drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
msgs: diag.messages.clone(), msgs: diag.messages.clone(),
args: args.clone(), args: args.clone(),
code: diag.code.clone(), code: diag.code,
lvl: diag.level(), lvl: diag.level(),
}))); })));
for child in &diag.children { for child in &diag.children {

View File

@ -1252,7 +1252,7 @@ impl DiagCtxtInner {
// be stored. Instead, they are buffered until the `LintExpectationId` is replaced by // be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
// a stable one by the `LintLevelsBuilder`. // a stable one by the `LintLevelsBuilder`.
if let Some(LintExpectationId::Unstable { .. }) = diagnostic.level.get_expectation_id() { if let Some(LintExpectationId::Unstable { .. }) = diagnostic.level.get_expectation_id() {
self.unstable_expect_diagnostics.push(diagnostic.clone()); self.unstable_expect_diagnostics.push(diagnostic);
return None; return None;
} }
@ -1267,16 +1267,14 @@ impl DiagCtxtInner {
DelayedBug(DelayedBugKind::Normal) => { DelayedBug(DelayedBugKind::Normal) => {
let backtrace = std::backtrace::Backtrace::capture(); let backtrace = std::backtrace::Backtrace::capture();
self.span_delayed_bugs self.span_delayed_bugs
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace)); .push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
#[allow(deprecated)] #[allow(deprecated)]
return Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()); return Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
} }
DelayedBug(DelayedBugKind::GoodPath) => { DelayedBug(DelayedBugKind::GoodPath) => {
let backtrace = std::backtrace::Backtrace::capture(); let backtrace = std::backtrace::Backtrace::capture();
self.good_path_delayed_bugs self.good_path_delayed_bugs
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace)); .push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
return None; return None;
} }
_ => {} _ => {}