diff options
| author | Urgau <urgau@numericable.fr> | 2025-04-20 19:24:23 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2025-04-20 19:24:23 +0200 |
| commit | 8307f972537815cc5870aeb7d2866756821b7675 (patch) | |
| tree | a7a11faa9fc1518a80a6a1ac313f2bafe5969fe1 /compiler/rustc_lint/src/nonstandard_style.rs | |
| parent | 191df20fcad9331d3a948aa8e8556775ec3fe69d (diff) | |
| download | rust-8307f972537815cc5870aeb7d2866756821b7675.tar.gz rust-8307f972537815cc5870aeb7d2866756821b7675.zip | |
Check bare function idents for non snake-case name
Diffstat (limited to 'compiler/rustc_lint/src/nonstandard_style.rs')
| -rw-r--r-- | compiler/rustc_lint/src/nonstandard_style.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index a3e7c84584d..d1138e8f1fa 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -422,6 +422,16 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { } } + fn check_ty(&mut self, cx: &LateContext<'_>, ty: &hir::Ty<'_, hir::AmbigArg>) { + if let hir::TyKind::BareFn(hir::BareFnTy { param_idents, .. }) = &ty.kind { + for param_ident in *param_idents { + if let Some(param_ident) = param_ident { + self.check_snake_case(cx, "variable", param_ident); + } + } + } + } + fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &hir::TraitItem<'_>) { if let hir::TraitItemKind::Fn(_, hir::TraitFn::Required(param_idents)) = item.kind { self.check_snake_case(cx, "trait method", &item.ident); |
