Closed
Description
I get this lint on names like:
SVGVersion_1_1
Suggests allowing numbers after underscore by replacing
!ident.contains_char('_')
with
!contains_invalid_after_underscore(ident)
This function to be put within 'is_camel_case':
// Allow trailing underscore or numeric after underscore.
fn contains_invalid_after_underscore(ident: &str) -> bool {
let mut last_was_underscore = false;
for c in ident.chars() {
if last_was_underscore && !"_0123456789".contains_char(c) {
return true;
}
last_was_underscore = c == '_';
}
false
}
Edit: changed to better version suggested by huonw.
Metadata
Metadata
Assignees
Labels
No labels