1
Fork 0

inline format!() args from rustc_codegen_llvm to the end (4)

r? @WaffleLapkin
This commit is contained in:
Matthias Krüger 2023-07-25 23:17:39 +02:00
parent 8327047b23
commit c64ef5e070
94 changed files with 385 additions and 498 deletions

View file

@ -342,7 +342,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
err.span_suggestion(
span,
"consider spelling out the type instead",
name.unwrap_or_else(|| format!("{:?}", ty)),
name.unwrap_or_else(|| format!("{ty:?}")),
Applicability::MaybeIncorrect,
);
}
@ -626,7 +626,7 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
"replace the {} parameters with concrete {}{}",
kinds,
kinds_pl,
egs.map(|egs| format!(" like `{}`", egs)).unwrap_or_default(),
egs.map(|egs| format!(" like `{egs}`")).unwrap_or_default(),
),
)
.emit();
@ -711,7 +711,7 @@ pub(super) fn check_specialization_validity<'tcx>(
} else {
tcx.sess.delay_span_bug(
DUMMY_SP,
format!("parent item: {:?} not marked as default", parent_impl),
format!("parent item: {parent_impl:?} not marked as default"),
);
}
}

View file

@ -1744,7 +1744,7 @@ fn compare_generic_param_kinds<'tcx>(
tcx.type_of(param.def_id).instantiate_identity()
)
}
Type { .. } => format!("{} type parameter", prefix),
Type { .. } => format!("{prefix} type parameter"),
Lifetime { .. } => unreachable!(),
};

View file

@ -134,7 +134,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: DefId) -> hir
/// Remember to add all intrinsics here, in `compiler/rustc_codegen_llvm/src/intrinsic.rs`,
/// and in `library/core/src/intrinsics.rs`.
pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
let param = |n| Ty::new_param(tcx, n, Symbol::intern(&format!("P{}", n)));
let param = |n| Ty::new_param(tcx, n, Symbol::intern(&format!("P{n}")));
let intrinsic_id = it.owner_id.to_def_id();
let intrinsic_name = tcx.item_name(intrinsic_id);
let name_str = intrinsic_name.as_str();
@ -494,7 +494,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
/// Type-check `extern "platform-intrinsic" { ... }` functions.
pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
let param = |n| {
let name = Symbol::intern(&format!("P{}", n));
let name = Symbol::intern(&format!("P{n}"));
Ty::new_param(tcx, n, name)
};

View file

@ -211,7 +211,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
// register class is usable at all.
if let Some(feature) = feature {
if !target_features.contains(feature) {
let msg = format!("`{}` target feature is not enabled", feature);
let msg = format!("`{feature}` target feature is not enabled");
let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
err.note(format!(
"this is required to use type `{}` with register class `{}`",

View file

@ -214,7 +214,7 @@ fn missing_items_err(
trait_item,
tcx.impl_trait_ref(impl_def_id).unwrap().instantiate_identity(),
);
let code = format!("{}{}\n{}", padding, snippet, padding);
let code = format!("{padding}{snippet}\n{padding}");
if let Some(span) = tcx.hir().span_if_local(trait_item.def_id) {
missing_trait_item_label
.push(errors::MissingTraitItemLabel { span, item: trait_item.name });

View file

@ -472,8 +472,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
let bound =
if unsatisfied_bounds.len() > 1 { "these bounds are" } else { "this bound is" };
err.note(format!(
"{} currently required to ensure that impls have maximum flexibility",
bound
"{bound} currently required to ensure that impls have maximum flexibility"
));
err.note(
"we are soliciting feedback, see issue #87479 \
@ -989,7 +988,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
let ty = tcx.erase_regions(ty);
if ty.has_infer() {
tcx.sess
.delay_span_bug(item.span, format!("inference variables in {:?}", ty));
.delay_span_bug(item.span, format!("inference variables in {ty:?}"));
// Just treat unresolved type expression as if it needs drop.
true
} else {
@ -1863,8 +1862,7 @@ fn report_bivariance(
if matches!(param.kind, hir::GenericParamKind::Type { .. }) && !has_explicit_bounds {
err.help(format!(
"if you intended `{0}` to be a const parameter, use `const {0}: usize` instead",
param_name
"if you intended `{param_name}` to be a const parameter, use `const {param_name}: usize` instead"
));
}
err.emit()