Skip to content

min_ident_chars doesn't trigger on trait methods #12237

Closed
@Centri3

Description

@Centri3

Summary

Trait methods aren't items in the HIR, rather trait items. We should handle them too
(This also happens with associated constants and types as well)

Lint Name

min_ident_chars

Reproducer

I tried this code:

#![warn(clippy::min_ident_chars)]

fn a() {}

trait A {
    const A: u32 = 0;

    type A;
    
    fn a() {}
}

I expected to see this happen:

All 5 items and associated items are linted

Instead, this happened:

Only the 2 items are, and the 3 associated items aren't linted

Version

rustc 1.78.0-nightly (256b6fb19 2024-02-06)                                                                             binary: rustc                                                                                                           commit-hash: 256b6fb19a2c018eaad4806d2369d1f6a71fc6ec                                                                   commit-date: 2024-02-06                                                                                                 host: x86_64-pc-windows-msvc                                                                                            release: 1.78.0-nightly                                                                                                 LLVM version: 17.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions