mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 05:26:23 +03:00
794b44de55
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