about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-24 21:26:56 +0000
committerbors <bors@rust-lang.org>2023-07-24 21:26:56 +0000
commit867e0ec0249bce7631c5590061028507ff4239b9 (patch)
tree41313cc405a2c98460292996cae290080827d852
parent31f37693e930d9f72f0c22e1056e23f481674cca (diff)
parent82982133a9c5ee663b26013ac8ebd3cfb0e0913f (diff)
downloadrust-867e0ec0249bce7631c5590061028507ff4239b9.tar.gz
rust-867e0ec0249bce7631c5590061028507ff4239b9.zip
Auto merge of #11218 - MrNossiom:master, r=Manishearth
changelog: [`min_ident_chars`]: don't lint const generics

Fixes: #11163

changelog: [`min_ident_chars`]: don't lint const generics
-rw-r--r--clippy_lints/src/min_ident_chars.rs8
-rw-r--r--tests/ui/min_ident_chars.rs4
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]);
+}