summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/partial_pub_fields.rs
blob: 668545da8441952687a8a510735f6cdbd43b855f (plain)
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
#![allow(unused)]
#![warn(clippy::partial_pub_fields)]

fn main() {
    use std::collections::HashMap;

    #[derive(Default)]
    pub struct FileSet {
        files: HashMap<String, u32>,
        pub paths: HashMap<u32, String>,
    }

    pub struct Color {
        pub r: u8,
        pub g: u8,
        b: u8,
    }

    pub struct Point(i32, pub i32);

    pub struct Visibility {
        r#pub: bool,
        pub pos: u32,
    }

    // Don't lint on empty structs;
    pub struct Empty1;
    pub struct Empty2();
    pub struct Empty3 {};

    // Don't lint on structs with one field.
    pub struct Single1(i32);
    pub struct Single2(pub i32);
    pub struct Single3 {
        v1: i32,
    }
    pub struct Single4 {
        pub v1: i32,
    }
}