Rfcs: #![allow(non_snake_case)] restricted by traits

Created on 26 Dec 2018  Â·  3Comments  Â·  Source: rust-lang/rfcs

We've #[allow(non_snake_case)] for declaring non-snake case field and method names. And #![allow(non_snake_case)] to permit non-snake case throughout a module.

Afaik, these are mostly gets used to obey mathematical conventions, like uppercase elliptic curve points corresponding to lowercase scalars, but these conventions would normally be restricted by type, so turning off snake case throughout sounds excessive, no?

I've no strong opinions about the ideal syntax, but maybe..

#[allow(non_snake_case(EdwardsPoint))]`
#[allow(non_snake_case(Matrix))]`

Another approach might be keeping non_snake_case as is, but permit more nuanced options in clippy.

Most helpful comment

You can also use #[allow] on an impl … {…} block, it’ll apply to each method of that block.

All 3 comments

You can also use #[allow] on an impl … {…} block, it’ll apply to each method of that block.

Sounds like there's a solution here. I'll close for now; feel free to re-open with more details if you think otherwise, @burdges.

It's fine to close. It's often members of one struct anyways. I think doing the impl helps lots if verbosity bothers you. I kinda wanted the opposite with more nuanced restrictions, but maybe doing it by type would annoy the parser.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

steveklabnik picture steveklabnik  Â·  4Comments

rust-highfive picture rust-highfive  Â·  4Comments

mqudsi picture mqudsi  Â·  3Comments

camden-smallwood-zz picture camden-smallwood-zz  Â·  3Comments

yongqli picture yongqli  Â·  3Comments