Rollup merge of #152372 - nyurik:clippy-rustc_trait_selection, r=mati865

style: remove unneeded trailing commas

Make format-like macro calls look similar to what `cargo fmt` does automatically - remove trailing commas. When removing a comma, I also inlined some variables for consistency and clarity.

I'm working on a [clippy lint](https://github.com/rust-lang/rust-clippy/pull/16530) to make this process automatic.
This commit is contained in:
Matthias Krüger 2026-02-11 13:48:49 +01:00 committed by GitHub
commit dbb1c20f47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 15 deletions

View file

@ -190,8 +190,8 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
}
Some(rbv::ResolvedArg::LateBound(debruijn_index, _, id)) => {
debug!("FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}", debruijn_index,);
debug!("id={:?}", id);
debug!("FindNestedTypeVisitor::visit_ty: LateBound depth = {debruijn_index:?}");
debug!("id={id:?}");
if debruijn_index == self.current_index && id.to_def_id() == self.region_def_id {
return ControlFlow::Break(());
}

View file

@ -239,14 +239,14 @@ pub fn suggest_new_region_bound(
};
spans_suggs.push((fn_return.span.shrink_to_hi(), format!(" + {name} ")));
err.multipart_suggestion_verbose(
format!("{declare} `{ty}` {captures}, {use_lt}",),
format!("{declare} `{ty}` {captures}, {use_lt}"),
spans_suggs,
Applicability::MaybeIncorrect,
);
} else {
err.span_suggestion_verbose(
fn_return.span.shrink_to_hi(),
format!("{declare} `{ty}` {captures}, {explicit}",),
format!("{declare} `{ty}` {captures}, {explicit}"),
&plus_lt,
Applicability::MaybeIncorrect,
);
@ -257,7 +257,7 @@ pub fn suggest_new_region_bound(
if let LifetimeKind::ImplicitObjectLifetimeDefault = lt.kind {
err.span_suggestion_verbose(
fn_return.span.shrink_to_hi(),
format!("{declare} the trait object {captures}, {explicit}",),
format!("{declare} the trait object {captures}, {explicit}"),
&plus_lt,
Applicability::MaybeIncorrect,
);

View file

@ -710,7 +710,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
predicate
);
let post = if post.len() > 1 || (post.len() == 1 && post[0].contains('\n')) {
format!(":\n{}", post.iter().map(|p| format!("- {p}")).collect::<Vec<_>>().join("\n"),)
format!(":\n{}", post.iter().map(|p| format!("- {p}")).collect::<Vec<_>>().join("\n"))
} else if post.len() == 1 {
format!(": `{}`", post[0])
} else {
@ -722,7 +722,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
err.note(format!("cannot satisfy `{predicate}`"));
}
(0, _, 1) => {
err.note(format!("{} in the `{}` crate{}", msg, crates[0], post,));
err.note(format!("{msg} in the `{}` crate{post}", crates[0]));
}
(0, _, _) => {
err.note(format!(
@ -739,7 +739,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
(_, 1, 1) => {
let span: MultiSpan = spans.into();
err.span_note(span, msg);
err.note(format!("and another `impl` found in the `{}` crate{}", crates[0], post,));
err.note(format!("and another `impl` found in the `{}` crate{post}", crates[0]));
}
_ => {
let span: MultiSpan = spans.into();

View file

@ -2263,7 +2263,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
err.highlighted_span_help(
self.tcx.def_span(def_id),
vec![
StringPart::normal(format!("the trait `{trait_}` ",)),
StringPart::normal(format!("the trait `{trait_}` ")),
StringPart::highlighted("is"),
StringPart::normal(desc),
StringPart::highlighted(self_ty),

View file

@ -888,7 +888,7 @@ impl<'tcx> OnUnimplementedFormatString {
}
} else {
let reported =
struct_span_code_err!(tcx.dcx(), self.span, E0231, "{}", e.description,)
struct_span_code_err!(tcx.dcx(), self.span, E0231, "{}", e.description)
.emit();
result = Err(reported);
}

View file

@ -312,7 +312,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// `async`/`gen` constructs get lowered to a special kind of coroutine that
// should *not* `impl Coroutine`.
ty::Coroutine(did, ..) if self.tcx().is_general_coroutine(*did) => {
debug!(?self_ty, ?obligation, "assemble_coroutine_candidates",);
debug!(?self_ty, ?obligation, "assemble_coroutine_candidates");
candidates.vec.push(CoroutineCandidate);
}
@ -334,7 +334,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// async constructs get lowered to a special kind of coroutine that
// should directly `impl Future`.
if self.tcx().coroutine_is_async(*did) {
debug!(?self_ty, ?obligation, "assemble_future_candidates",);
debug!(?self_ty, ?obligation, "assemble_future_candidates");
candidates.vec.push(FutureCandidate);
}
@ -352,7 +352,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
if let ty::Coroutine(did, ..) = self_ty.kind()
&& self.tcx().coroutine_is_gen(*did)
{
debug!(?self_ty, ?obligation, "assemble_iterator_candidates",);
debug!(?self_ty, ?obligation, "assemble_iterator_candidates");
candidates.vec.push(IteratorCandidate);
}
@ -378,7 +378,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// gen constructs get lowered to a special kind of coroutine that
// should directly `impl AsyncIterator`.
if self.tcx().coroutine_is_async_gen(did) {
debug!(?self_ty, ?obligation, "assemble_iterator_candidates",);
debug!(?self_ty, ?obligation, "assemble_iterator_candidates");
// Can only confirm this candidate if we have constrained
// the `Yield` type to at least `Poll<Option<?0>>`..

View file

@ -1223,7 +1223,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
&& self.match_fresh_trait_preds(stack.fresh_trait_pred, prev.fresh_trait_pred)
})
{
debug!("evaluate_stack --> unbound argument, recursive --> giving up",);
debug!("evaluate_stack --> unbound argument, recursive --> giving up");
return Ok(EvaluatedToAmbigStackDependent);
}