File: lint-nonstandard-style-unicode-1.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (49 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![allow(dead_code)]

#![forbid(non_camel_case_types)]

// Some scripts (e.g., hiragana) don't have a concept of
// upper/lowercase

// 1. non_camel_case_types

// Can start with non-lowercase letter
struct Θχ;
struct ヒa;

struct χa;
//~^ ERROR type `χa` should have an upper camel case name

// If there's already leading or trailing underscores, they get trimmed before checking.
// This is fine:
struct _ヒb;

// This is not:
struct __χa;
//~^ ERROR type `__χa` should have an upper camel case name

// Besides this, we cannot have two continuous underscores in the middle.

struct 对__否;
//~^ ERROR type `对__否` should have an upper camel case name

struct ヒ__χ;
//~^ ERROR type `ヒ__χ` should have an upper camel case name

// also cannot have lowercase letter next to an underscore.
// so this triggers the lint:

struct Hello_你好;
//~^ ERROR type `Hello_你好` should have an upper camel case name

struct Hello_World;
//~^ ERROR type `Hello_World` should have an upper camel case name

struct 你_ӟ;
//~^ ERROR type `你_ӟ` should have an upper camel case name

// and this is ok:

struct 你_好;

fn main() {}