3 // aux-build:wildcard_imports_helper.rs
5 // the 2015 edition here is needed because edition 2018 changed the module system
6 // (see https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html) which means the lint
7 // no longer detects some of the cases starting with Rust 2018.
9 #![warn(clippy::wildcard_imports)]
10 #![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)]
11 #![warn(unused_imports)]
13 extern crate wildcard_imports_helper;
16 use crate::mod_mod::*;
17 use crate::multi_fn_mod::*;
19 use crate::struct_mod::*;
21 #[allow(unused_imports)]
22 use wildcard_imports_helper::inner::inner_for_self_import;
23 use wildcard_imports_helper::inner::inner_for_self_import::*;
24 use wildcard_imports_helper::*;
26 use std::io::prelude::*;
27 use wildcard_imports_helper::prelude::v1::*;
31 impl Read for ReadFoo {
32 fn read(&mut self, _buf: &mut [u8]) -> std::io::Result<usize> {
51 pub mod multi_inner_mod {
59 pub mod inner_struct_mod {
64 macro_rules! double_struct_import_test {
75 multi_inner_mod::foo();
81 let _ = inner_struct_mod::C;
83 let _ = PreludeModAnywhere;
85 double_struct_import_test!();
86 double_struct_import_test!();
90 pub use self::inner_exported::*;
91 #[allow(unused_imports)]
92 pub(crate) use self::inner_exported2::*;
101 use wildcard_imports_helper::inner::inner_for_self_import::{self, *};
102 use wildcard_imports_helper::*;
104 inner_for_self_import::inner_extern_foo();
112 fn test_inner_nested() {
113 use self::{inner::*, inner2::*};
119 fn test_extern_reexported() {
120 use wildcard_imports_helper::*;
123 let _ = ExternExportedStruct;
124 let _ = ExternExportedEnum::A;
129 pub struct ExportedStruct;
130 pub enum ExportedEnum {
135 mod inner_exported2 {
136 pub(crate) fn exported2() {}
140 pub fn inner_foo() {}
144 pub fn inner_bar() {}
148 fn test_reexported() {
149 use crate::in_fn_test::*;
152 let _ = ExportedStruct;
153 let _ = ExportedEnum::A;
157 fn test_weird_formatting() {
158 use crate:: in_fn_test:: * ;
169 mod should_be_replaced {
177 mod test_should_pass {
185 mod test_should_pass_inside_function {
186 fn with_super_inside_function() {
192 mod test_should_pass_further_inside {
202 mod should_be_replaced_further_inside {
212 mod use_explicit_should_be_replaced {
213 use super_imports::*;
220 mod use_double_super_should_be_replaced {
224 fn with_double_super() {
230 mod use_super_explicit_should_be_replaced {
231 use super::super::super_imports::*;
233 fn with_super_explicit() {
238 mod attestation_should_be_replaced {