File: lint-non-camel-case-types.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 (37 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (15)
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
#![forbid(non_camel_case_types)]
#![allow(dead_code)]

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

struct foo { //~ ERROR type `foo` should have an upper camel case name
    bar: isize,
}

enum foo2 { //~ ERROR type `foo2` should have an upper camel case name
    Bar
}

struct foo3 { //~ ERROR type `foo3` should have an upper camel case name
    bar: isize
}

type foo4 = isize; //~ ERROR type `foo4` should have an upper camel case name

enum Foo5 {
    bar //~ ERROR variant `bar` should have an upper camel case name
}

trait foo6 { //~ ERROR trait `foo6` should have an upper camel case name
    type foo7; //~ ERROR associated type `foo7` should have an upper camel case name
    fn dummy(&self) { }
}

fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have an upper camel case name

#[repr(C)]
struct foo7 {
    bar: isize,
}

fn main() { }