1 //@run-rustfix 2 #![allow(dead_code)] 3 #![warn(clippy::redundant_pub_crate)] 4 5 mod m1 { f()6 fn f() {} g()7 pub(crate) fn g() {} // private due to m1 h()8 pub fn h() {} 9 10 mod m1_1 { f()11 fn f() {} g()12 pub(crate) fn g() {} // private due to m1_1 and m1 h()13 pub fn h() {} 14 } 15 16 pub(crate) mod m1_2 { 17 //:^ private due to m1 f()18 fn f() {} g()19 pub(crate) fn g() {} // private due to m1_2 and m1 h()20 pub fn h() {} 21 } 22 23 pub mod m1_3 { f()24 fn f() {} g()25 pub(crate) fn g() {} // private due to m1 h()26 pub fn h() {} 27 } 28 } 29 30 pub(crate) mod m2 { f()31 fn f() {} g()32 pub(crate) fn g() {} // already crate visible due to m2 h()33 pub fn h() {} 34 35 mod m2_1 { f()36 fn f() {} g()37 pub(crate) fn g() {} // private due to m2_1 h()38 pub fn h() {} 39 } 40 41 pub(crate) mod m2_2 { 42 //:^ already crate visible due to m2 f()43 fn f() {} g()44 pub(crate) fn g() {} // already crate visible due to m2_2 and m2 h()45 pub fn h() {} 46 } 47 48 pub mod m2_3 { f()49 fn f() {} g()50 pub(crate) fn g() {} // already crate visible due to m2 h()51 pub fn h() {} 52 } 53 } 54 55 pub mod m3 { f()56 fn f() {} g()57 pub(crate) fn g() {} // ok: m3 is exported h()58 pub fn h() {} 59 60 mod m3_1 { f()61 fn f() {} g()62 pub(crate) fn g() {} // private due to m3_1 h()63 pub fn h() {} 64 } 65 66 pub(crate) mod m3_2 { 67 //:^ ok f()68 fn f() {} g()69 pub(crate) fn g() {} // already crate visible due to m3_2 h()70 pub fn h() {} 71 } 72 73 pub mod m3_3 { f()74 fn f() {} g()75 pub(crate) fn g() {} // ok: m3 and m3_3 are exported h()76 pub fn h() {} 77 } 78 } 79 80 mod m4 { f()81 fn f() {} g()82 pub(crate) fn g() {} // private: not re-exported by `pub use m4::*` h()83 pub fn h() {} 84 85 mod m4_1 { f()86 fn f() {} g()87 pub(crate) fn g() {} // private due to m4_1 h()88 pub fn h() {} 89 } 90 91 pub(crate) mod m4_2 { 92 //:^ private: not re-exported by `pub use m4::*` f()93 fn f() {} g()94 pub(crate) fn g() {} // private due to m4_2 h()95 pub fn h() {} 96 } 97 98 pub mod m4_3 { f()99 fn f() {} g()100 pub(crate) fn g() {} // ok: m4_3 is re-exported by `pub use m4::*` h()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 main()117fn main() {} 118