]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/redundant_pub_crate.rs
Rollup merge of #96336 - Nilstrieb:link-to-correct-as_mut-in-ptr-as_ref, r=JohnTitor
[rust.git] / src / tools / clippy / tests / ui / redundant_pub_crate.rs
1 // run-rustfix
2 #![allow(dead_code)]
3 #![warn(clippy::redundant_pub_crate)]
4
5 mod m1 {
6     fn f() {}
7     pub(crate) fn g() {} // private due to m1
8     pub fn h() {}
9
10     mod m1_1 {
11         fn f() {}
12         pub(crate) fn g() {} // private due to m1_1 and m1
13         pub fn h() {}
14     }
15
16     pub(crate) mod m1_2 {
17         // ^ private due to m1
18         fn f() {}
19         pub(crate) fn g() {} // private due to m1_2 and m1
20         pub fn h() {}
21     }
22
23     pub mod m1_3 {
24         fn f() {}
25         pub(crate) fn g() {} // private due to m1
26         pub fn h() {}
27     }
28 }
29
30 pub(crate) mod m2 {
31     fn f() {}
32     pub(crate) fn g() {} // already crate visible due to m2
33     pub fn h() {}
34
35     mod m2_1 {
36         fn f() {}
37         pub(crate) fn g() {} // private due to m2_1
38         pub fn h() {}
39     }
40
41     pub(crate) mod m2_2 {
42         // ^ already crate visible due to m2
43         fn f() {}
44         pub(crate) fn g() {} // already crate visible due to m2_2 and m2
45         pub fn h() {}
46     }
47
48     pub mod m2_3 {
49         fn f() {}
50         pub(crate) fn g() {} // already crate visible due to m2
51         pub fn h() {}
52     }
53 }
54
55 pub mod m3 {
56     fn f() {}
57     pub(crate) fn g() {} // ok: m3 is exported
58     pub fn h() {}
59
60     mod m3_1 {
61         fn f() {}
62         pub(crate) fn g() {} // private due to m3_1
63         pub fn h() {}
64     }
65
66     pub(crate) mod m3_2 {
67         // ^ ok
68         fn f() {}
69         pub(crate) fn g() {} // already crate visible due to m3_2
70         pub fn h() {}
71     }
72
73     pub mod m3_3 {
74         fn f() {}
75         pub(crate) fn g() {} // ok: m3 and m3_3 are exported
76         pub fn h() {}
77     }
78 }
79
80 mod m4 {
81     fn f() {}
82     pub(crate) fn g() {} // private: not re-exported by `pub use m4::*`
83     pub fn h() {}
84
85     mod m4_1 {
86         fn f() {}
87         pub(crate) fn g() {} // private due to m4_1
88         pub fn h() {}
89     }
90
91     pub(crate) mod m4_2 {
92         // ^ private: not re-exported by `pub use m4::*`
93         fn f() {}
94         pub(crate) fn g() {} // private due to m4_2
95         pub fn h() {}
96     }
97
98     pub mod m4_3 {
99         fn f() {}
100         pub(crate) fn g() {} // ok: m4_3 is re-exported by `pub use m4::*`
101         pub fn h() {}
102     }
103 }
104
105 pub use m4::*;
106
107 mod issue_8732 {
108     #[allow(unused_macros)]
109     macro_rules! some_macro {
110         () => {};
111     }
112
113     #[allow(unused_imports)]
114     pub(crate) use some_macro; // ok: macro exports are exempt
115 }
116
117 fn main() {}