Files
rust/compiler
Jacob Pratt 794b44de55 Rollup merge of #156843 - onehr:fix-redundant-captures-143216, r=cjgillot
Make impl_trait_redundant_captures suggestion remove adjacent +

Closes rust-lang/rust#143216

The `impl_trait_redundant_captures` lint's machine-applicable suggestion only
spanned the `use<...>` syntax itself, leaving the adjacent `+` joiner behind.
Applying the suggestion produced uncompilable code, e.g.
`impl Sized + use<>` becoming `impl Sized + ` (stray trailing `+`).

This extends the removal span to also cover one adjacent `+`, preserving
valid syntax in the three bound-list positions covered by the regression test:

- `impl Sized + use<>` becomes `impl Sized`
- `impl use<> + Sized` becomes `impl Sized`
- `impl Sized + use<> + Send` becomes `impl Sized + Send`

A `//@ run-rustfix` UI test exercises all three positions, so the
rustfix-applied output is actually compiled — covering the gap the
existing `redundant.rs` test left (which only checks lint firing, not
suggestion correctness).

Tested:
- ./x test tests/ui/impl-trait/precise-capturing/redundant-machine-applicable.rs --bless
- ./x test tidy
2026-05-24 16:39:43 +02:00
..
2026-05-04 16:28:58 +00:00
2026-05-04 16:28:58 +00:00
2026-05-22 19:40:22 +09:00
2026-05-11 21:32:42 +02:00
2026-05-12 21:58:50 +02:00
2026-05-24 17:33:46 +09:00
2026-05-22 12:36:19 +03:00
2026-05-12 21:58:50 +02:00
2026-04-08 21:09:07 +02:00
2026-05-22 19:40:22 +09:00