We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbfdf0b commit b9f0ca1Copy full SHA for b9f0ca1
compiler/rustc_lint/src/nonstandard_style.rs
@@ -274,18 +274,13 @@ impl NonSnakeCase {
274
let ident = ident.trim_start_matches('\'');
275
let ident = ident.trim_matches('_');
276
277
- let mut allow_underscore = true;
278
- ident.chars().all(|c| {
279
- allow_underscore = match c {
280
- '_' if !allow_underscore => return false,
281
- '_' => false,
282
- // It would be more obvious to use `c.is_lowercase()`,
283
- // but some characters do not have a lowercase form
284
- c if !c.is_uppercase() => true,
285
- _ => return false,
286
- };
287
- true
288
- })
+ if ident.contains("__") {
+ return false;
+ }
+
+ // This correctly handles letters in languages with and without
+ // cases, as well as numbers and underscores.
+ !ident.chars().any(char::is_uppercase)
289
}
290
291
let name = ident.name.as_str();
0 commit comments