rust/tests
llogiq 8f1b4bb87a
New lint: unnecessary_semicolon (#14032)
This lint detects and removes the unnecessary semicolon after a `match`
or `if` statement returning `()`. It seems to be quite a common
"mistake", given the number of hits (88) we had in the Clippy sources
themselves.

The lint doesn't bother about loops, as `rustfmt` already removes the
extra semicolon. It doesn't handle blocks either, as an extra block
level, followed or not by a semicolon, is likely intentional.

I propose to put the lint in `pedantic`, as putting it in `style` seems
quite hazardous given the number of hits.

Note: there exists a `redundant-semicolon` lint in the compiler, but it
is an early lint and cannot check that the expression evaluates to `()`,
so it ignores the cases we're handling here.

----

changelog: [`unnecessary_semicolon`]: new lint
2025-01-20 17:39:37 +00:00
..
test_utils
ui New lint: unnecessary_semicolon (#14032) 2025-01-20 17:39:37 +00:00
ui-cargo Merge commit '68a799aea9' into clippy-subtree-update 2024-06-27 18:56:04 +02:00
ui-internal Merge remote-tracking branch 'upstream/master' into rustup 2025-01-09 18:00:37 +01:00
ui-toml Merge remote-tracking branch 'upstream/master' into rustup 2025-01-09 18:00:37 +01:00
workspace_test Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
check-fmt.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
clippy.toml
compile-test.rs In edition 2024, std::env::set_var is unsafe 2025-01-13 15:58:11 +01:00
config-metadata.rs Merge commit 'a109190d70' into clippy-subtree-update 2024-10-18 13:44:06 +02:00
dogfood.rs Merge commit '7901289135' into clippy-subtree-update 2024-09-24 11:58:04 +02:00
headers.rs Merge commit 'a859e5cc1c' into clippyup 2023-12-16 14:12:50 +01:00
integration.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
lint_message_convention.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
missing-test-files.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
versioncheck.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
workspace.rs Stabilize LazyCell and LazyLock (lazy_cell) 2024-02-20 20:55:13 -07:00