sqlx
sqlx copied to clipboard
Add `#[allow(clippy::use_self)]` for derived traits
Bug Description
Warning messages are generated by clippy when deriving Type for enums if clippy::use-self is set to warning level, saying "unnecessary structure name repetition".
Minimal Reproduction
use sqlx::Type;
#[allow(unused)]
#[allow(clippy::use_self)]
#[derive(Type)]
#[sqlx(type_name = "lang")]
pub enum Lang {
Chinese,
English,
}
Info
- SQLx version: 0.6.1
- SQLx features enabled: macros, postgres, runtime-tokio-native-tls
- Database server and version: Postgres 14.3
- Operating system: Fedora 36
-
rustc --version: rustc 1.65.0-nightly (addacb587 2022-08-24)
It's honestly rather annoying that Clippy lints generated code at all. It should be able to tell from the hygiene information which code the user wrote and which code they didn't, although I forget if derives are actually hygienic at all.
We also mark the generated impls with #[automatically_derived] which is about as explicit of a hint you can get.
That said, we should probably just mark generated code with #[allow(clippy::all)] instead of playing whack-a-mole with its pedantic lints.