Skip to content

Commit a3a3f4d

Browse files
committed
avoid unnecessary &str to String conversions
1 parent 33b55ac commit a3a3f4d

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
507507
_ => "aren't",
508508
},
509509
),
510-
" else { todo!() }".to_string(),
510+
" else { todo!() }",
511511
Applicability::HasPlaceholders,
512512
);
513513
}

compiler/rustc_resolve/src/late/diagnostics.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -784,10 +784,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
784784
return false;
785785
}
786786
err.code(rustc_errors::error_code!(E0411));
787-
err.span_label(
788-
span,
789-
"`Self` is only available in impls, traits, and type definitions".to_string(),
790-
);
787+
err.span_label(span, "`Self` is only available in impls, traits, and type definitions");
791788
if let Some(item_kind) = self.diagnostic_metadata.current_item {
792789
err.span_label(
793790
item_kind.ident.span,

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ pub fn is_const_evaluatable<'tcx>(
192192
}
193193
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
194194
match concrete {
195-
Err(ErrorHandled::TooGeneric) => {
196-
Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
197-
span,
198-
format!("Missing value for constant, but no error reported?"),
199-
)))
200-
}
195+
Err(ErrorHandled::TooGeneric) => Err(NotConstEvaluatable::Error(
196+
infcx
197+
.tcx
198+
.sess
199+
.delay_span_bug(span, "Missing value for constant, but no error reported?"),
200+
)),
201201
Err(ErrorHandled::Linted) => {
202202
let reported = infcx
203203
.tcx

0 commit comments

Comments
 (0)