greyblake / nutype

Rust newtype with guarantees πŸ‡ΊπŸ‡¦ πŸ¦€
MIT License
1.42k stars 23 forks source link

make `__nutype_{type_name}__` compatible with clippy lint #190

Closed vic1707 closed 1 month ago

vic1707 commented 1 month ago

rust analyzer in VSCode complains about generated nutype module not being proper snake case, this PR fixes that with a naive to_lower_case call as I think nobody really cares about how exactly it is named except clippy x).

{FF067F22-4979-41A5-ABAC-D9099C9E9C7E}
greyblake commented 1 month ago

Thanks. I think we should rather ignore the lint explicitly.

My concern is having 2 different types like

struct Notebook(..)

struct NotEBook(..)

can cause undesired collision in the module names.

greyblake commented 1 month ago

@vic1707 Could you please apply #[allow(non_snake_case)] instead?

vic1707 commented 1 month ago

Yeah you're right, I didn't think about it πŸ‘ I chose to #[allow(non_snake_case, reason = "we keep original structure name which is probably CamelCase")]. Since not providing a reason can also trigger a warning x)

{381A8C5E-6318-4F34-890B-291B0178D429}

(yes I pretty much enable every available lint on my projects, sometimes a pain but worth it since I learn a lot and helpful when clippy suggests better versions of my code)

greyblake commented 1 month ago

Thank you!