diff options
| author | Milo Moisson <milomoisson@gmail.com> | 2023-07-24 14:54:55 +0200 |
|---|---|---|
| committer | Milo Moisson <milomoisson@gmail.com> | 2023-07-24 14:59:27 +0200 |
| commit | 82982133a9c5ee663b26013ac8ebd3cfb0e0913f (patch) | |
| tree | eb84e793d545273e4d8d65c051cb3f32c39161ba | |
| parent | 43577d58f96d95d80cfff206b33f6b2545139a19 (diff) | |
| download | rust-82982133a9c5ee663b26013ac8ebd3cfb0e0913f.tar.gz rust-82982133a9c5ee663b26013ac8ebd3cfb0e0913f.zip | |
changelog: [`min_ident_chars`]: don't lint const generics
| -rw-r--r-- | clippy_lints/src/min_ident_chars.rs | 8 | ||||
| -rw-r--r-- | tests/ui/min_ident_chars.rs | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clippy_lints/src/min_ident_chars.rs b/clippy_lints/src/min_ident_chars.rs index 2a60f2faca0..c79a1a7b9d4 100644 --- a/clippy_lints/src/min_ident_chars.rs +++ b/clippy_lints/src/min_ident_chars.rs @@ -129,6 +129,14 @@ impl Visitor<'_> for IdentVisitor<'_, '_> { return; } + // `struct Array<T, const N: usize>([T; N])` + // ^ + if let Node::GenericParam(generic_param) = node + && let GenericParamKind::Const { .. } = generic_param.kind + { + return; + } + if is_from_proc_macro(cx, &ident) { return; } diff --git a/tests/ui/min_ident_chars.rs b/tests/ui/min_ident_chars.rs index 0fab224a29d..03784442e2c 100644 --- a/tests/ui/min_ident_chars.rs +++ b/tests/ui/min_ident_chars.rs @@ -81,3 +81,7 @@ fn b() {} fn wrong_pythagoras(a: f32, b: f32) -> f32 { a * a + a * b } + +mod issue_11163 { + struct Array<T, const N: usize>([T; N]); +} |
