Rollup merge of #103726 - TaKO8Ki:avoid-&str-to-string-conversions, r=compiler-errors
Avoid unnecessary `&str` to `String` conversions
This commit is contained in:
commit
2bff9e2193
3 changed files with 8 additions and 11 deletions
|
@ -507,7 +507,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
|
||||||
_ => "aren't",
|
_ => "aren't",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
" else { todo!() }".to_string(),
|
" else { todo!() }",
|
||||||
Applicability::HasPlaceholders,
|
Applicability::HasPlaceholders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -784,10 +784,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
err.code(rustc_errors::error_code!(E0411));
|
err.code(rustc_errors::error_code!(E0411));
|
||||||
err.span_label(
|
err.span_label(span, "`Self` is only available in impls, traits, and type definitions");
|
||||||
span,
|
|
||||||
"`Self` is only available in impls, traits, and type definitions".to_string(),
|
|
||||||
);
|
|
||||||
if let Some(item_kind) = self.diagnostic_metadata.current_item {
|
if let Some(item_kind) = self.diagnostic_metadata.current_item {
|
||||||
err.span_label(
|
err.span_label(
|
||||||
item_kind.ident.span,
|
item_kind.ident.span,
|
||||||
|
|
|
@ -192,12 +192,12 @@ pub fn is_const_evaluatable<'tcx>(
|
||||||
}
|
}
|
||||||
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
|
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
|
||||||
match concrete {
|
match concrete {
|
||||||
Err(ErrorHandled::TooGeneric) => {
|
Err(ErrorHandled::TooGeneric) => Err(NotConstEvaluatable::Error(
|
||||||
Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
|
infcx
|
||||||
span,
|
.tcx
|
||||||
format!("Missing value for constant, but no error reported?"),
|
.sess
|
||||||
)))
|
.delay_span_bug(span, "Missing value for constant, but no error reported?"),
|
||||||
}
|
)),
|
||||||
Err(ErrorHandled::Linted) => {
|
Err(ErrorHandled::Linted) => {
|
||||||
let reported = infcx
|
let reported = infcx
|
||||||
.tcx
|
.tcx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue