You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TBD for enum members / struct fields / assoc. consts / assoc. types, where this makes a bit more sense, e.g.:
structPoint{x:usize,y:usize,}
Generics (e.g. T) should be allowed to remain single letter idents (IMO, can also be debated)
Alternatively, could be a min_ident_len lint which has configuration (since 2 letter idents might also be undesirable)
The lint could also optionally (or by configuration) whitelist specific identifiers which are common, e.g. n for number functions, i, x, y, etc. This could be narrowed to only allow these if they're of specific types to avoid confusion and still restrict the same identifiers for arbitrary cases. TBD whether this is desirable.
The text was updated successfully, but these errors were encountered:
What it does
I'd like to suggest a restriction,
single_letter_ident
, which forbids identifiers that are a single letterAdvantage
This would allow projects that want to enforce longer identifier names (for readability) to do so without breaking existing projects
Drawbacks
None that I can think of, as it's a restriction which needs to be opted into
Example
Could be written as:
This would also forbid the following:
TBD for enum members / struct fields / assoc. consts / assoc. types, where this makes a bit more sense, e.g.:
Generics (e.g.
T
) should be allowed to remain single letter idents (IMO, can also be debated)Alternatively, could be a
min_ident_len
lint which has configuration (since 2 letter idents might also be undesirable)The lint could also optionally (or by configuration) whitelist specific identifiers which are common, e.g.
n
for number functions,i
,x
,y
, etc. This could be narrowed to only allow these if they're of specific types to avoid confusion and still restrict the same identifiers for arbitrary cases. TBD whether this is desirable.The text was updated successfully, but these errors were encountered: