summary refs log tree commit diff
path: root/tests/ui/lint/dead-code/unused-pub-struct.rs
blob: aaf4dd612de4dcbf7c0f3a997896bfb93108b083 (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
41
42
43
44
45
46
47
48
#![deny(dead_code)]

pub struct NotLint1(());
pub struct NotLint2(std::marker::PhantomData<i32>);

pub struct NeverConstructed(i32); //~ ERROR struct `NeverConstructed` is never constructed

impl NeverConstructed {
    pub fn not_construct_self(&self) {}
}

impl Clone for NeverConstructed {
    fn clone(&self) -> NeverConstructed {
        NeverConstructed(0)
    }
}

pub trait Trait {
    fn not_construct_self(&self);
}

impl Trait for NeverConstructed {
    fn not_construct_self(&self) {
        self.0;
    }
}

pub struct Constructed(i32);

impl Constructed {
    pub fn construct_self() -> Self {
        Constructed(0)
    }
}

impl Clone for Constructed {
    fn clone(&self) -> Constructed {
        Constructed(0)
    }
}

impl Trait for Constructed {
    fn not_construct_self(&self) {
        self.0;
    }
}

fn main() {}