Skip to content

Commit df322fc

Browse files
committed
Remove some unnecessary clone calls.
1 parent 8ba25d0 commit df322fc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ impl Emitter for SharedEmitter {
18171817
drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
18181818
msgs: diag.messages.clone(),
18191819
args: args.clone(),
1820-
code: diag.code.clone(),
1820+
code: diag.code,
18211821
lvl: diag.level(),
18221822
})));
18231823
for child in &diag.children {

compiler/rustc_errors/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ impl DiagCtxtInner {
12521252
// be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
12531253
// a stable one by the `LintLevelsBuilder`.
12541254
if let Some(LintExpectationId::Unstable { .. }) = diagnostic.level.get_expectation_id() {
1255-
self.unstable_expect_diagnostics.push(diagnostic.clone());
1255+
self.unstable_expect_diagnostics.push(diagnostic);
12561256
return None;
12571257
}
12581258

@@ -1267,16 +1267,14 @@ impl DiagCtxtInner {
12671267
DelayedBug(DelayedBugKind::Normal) => {
12681268
let backtrace = std::backtrace::Backtrace::capture();
12691269
self.span_delayed_bugs
1270-
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace));
1271-
1270+
.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
12721271
#[allow(deprecated)]
12731272
return Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
12741273
}
12751274
DelayedBug(DelayedBugKind::GoodPath) => {
12761275
let backtrace = std::backtrace::Backtrace::capture();
12771276
self.good_path_delayed_bugs
1278-
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace));
1279-
1277+
.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
12801278
return None;
12811279
}
12821280
_ => {}

0 commit comments

Comments
 (0)