rust/tests
Alex Macleod a6dfbb3524
Stop inserting redundant parenthesis around desugared match expressions (#16102)
Currently the `sugg` utility treats all `ExprKind::Match` expressions as
potentially needing brackets, and therefore many lints will add
parenthesis around them. However this includes desugared match
expressions like the `?` and `.await` operators.

In this PR I have updated the utility to only treat match expressions
which include a code block as needing parenthesis, as the other types
have similar precedence rules and expectations to things like member
access and I think can be treated like as such.

While this change is small on paper it touches a large amount of code
due to changing a cross cutting concern, I am happy to add additional
tests if we think it is needed, but I wanted to get a feel for if this
is even a sensible change to be doing and what the expectations were
around the level of testing needed before investing more time into it.

Regarding not putting a specific lint in the changelog, determining all
the lints this could possibly effect would be possible but take some
time, and I wonder if it would be a bit too noisy in the changelog. Open
to suggestions about how best to address that.

fixes rust-lang/rust-clippy#16045

changelog: stop inserting unnecessary brackets around `x?` and `x.await`
expressions in suggestions
2025-11-27 18:49:07 +00:00
..
test_utils
ui Stop inserting redundant parenthesis around desugared match expressions (#16102) 2025-11-27 18:49:07 +00:00
ui-cargo Merge commit 'd9fb15c4b1' into clippy-subtree-update 2025-10-16 20:38:28 +02:00
ui-internal Merge commit 'e9b70454e4' into clippy-subtree-update 2025-09-04 18:27:27 -04:00
ui-toml Add large-error-ignored config-knob (#15697) 2025-11-23 14:28:51 +00:00
workspace_test
check-fmt.rs
clippy.toml
compile-test.rs Merge commit 'd9fb15c4b1' into clippy-subtree-update 2025-10-16 20:38:28 +02:00
config-consistency.rs Merge commit 'e9b70454e4' into clippy-subtree-update 2025-09-04 18:27:27 -04:00
config-metadata.rs
dogfood.rs Merge commit 'c5dbd1de07' into clippy-subtree-update 2025-06-27 12:20:57 +02:00
integration.rs
lint_message_convention.rs
missing-test-files.rs Apply cfg(bootstrap) replacement 2025-09-26 19:09:23 -04:00
no-profile-in-cargo-toml.rs Merge commit '20ce69b9a6' into clippy-subtree-update 2025-09-18 17:21:44 +02:00
symbols-used.rs Merge commit 'd9fb15c4b1' into clippy-subtree-update 2025-10-16 20:38:28 +02:00
versioncheck.rs Merge commit 'c5dbd1de07' into clippy-subtree-update 2025-06-27 12:20:57 +02:00
workspace.rs