There was an error while loading. Please reload this page.
1 parent cbfdf0b commit b9f0ca1Copy full SHA for b9f0ca1
1 file changed
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
-letmut allow_underscore = true;
278
- ident.chars().all(|c| {
279
- allow_underscore = match c {
280
-'_'if !allow_underscore => returnfalse,
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
- _ => returnfalse,
286
-};
287
-true
288
-})
+if ident.contains("__"){
+returnfalse;
+}
+
+// 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