Skip to content

Commit

Permalink
Auto merge of #11218 - MrNossiom:master, r=Manishearth
Browse files Browse the repository at this point in the history
changelog: [`min_ident_chars`]: don't lint const generics

Fixes: #11163

changelog: [`min_ident_chars`]: don't lint const generics
  • Loading branch information
bors committed Jul 24, 2023
2 parents 31f3769 + 8298213 commit 867e0ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clippy_lints/src/min_ident_chars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/min_ident_chars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

0 comments on commit 867e0ec

Please sign in to comment.