about summary refs log tree commit diff
path: root/clippy_lints/src/missing_inline.rs
diff options
context:
space:
mode:
authorllogiq <bogusandre@gmail.com>2025-01-20 17:39:37 +0000
committerGitHub <noreply@github.com>2025-01-20 17:39:37 +0000
commit8f1b4bb87a9c028391f779c83dd4cecb615bd67b (patch)
tree559b324fb2d8beebea8d6dbb9c275288ce42ed13 /clippy_lints/src/missing_inline.rs
parent2280b8a09967891b6c3d2d53a001c514954489c3 (diff)
parent3a7f50f6d3e5f96dc130296c1a94077fb0f37bf8 (diff)
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
Diffstat (limited to 'clippy_lints/src/missing_inline.rs')
-rw-r--r--clippy_lints/src/missing_inline.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs
index 05aa425de9e..bba1b63be27 100644
--- a/clippy_lints/src/missing_inline.rs
+++ b/clippy_lints/src/missing_inline.rs
@@ -135,7 +135,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
             | hir::ItemKind::ForeignMod { .. }
             | hir::ItemKind::Impl { .. }
             | hir::ItemKind::Use(..) => {},
-        };
+        }
     }
 
     fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {