rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.79k stars 1.52k forks source link

`non_camel_case_types` warning can fire spuriously in macros, even when `#[allow]`ed in that module #17306

Open SludgePhD opened 1 month ago

SludgePhD commented 1 month ago

A module that contains a non-camel-case type will produce a warning even though #![allow(bad_style)] is present to silence the rustc warning. Adding #![allow(non_camel_case_types)] works around this, but rust-analyzer should respect lint groups.

mathew-horner commented 1 month ago

Hmm, it works for me on master and stable. What version are you on?

SludgePhD commented 1 month ago

Huh, yeah, the actual issue here is more subtle. It can be reproduced by looking at this file: https://github.com/SludgePhD/FeV/blob/dd16b90ee3a93ebc7a72f32ad145ef3b9b6cdde5/src/dlopen.rs

The issue I'm seeing can be (somewhat unreliably) reproduced by replacing the identifier vaGetDisplayDRM with vaGetDisplayDR M (ie. breaking it into two idents).

When doing that, rust-analyzer will occasionally emit a warning like "Type alias vaGetDisplayDRM should have CamelCase name, e.g. VaGetDisplayDrm" (sometimes even for the other function names in that module!).

It might be caused by everything going through a macro.