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