]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/unused_import_warning_issue_45268.rs
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / unused_import_warning_issue_45268.rs
1 // check-pass
2
3 #![warn(unused_imports)] // Warning explanation here, it's OK
4
5 mod test {
6     pub trait A {
7         fn a();
8     }
9
10     impl A for () {
11         fn a() { }
12     }
13
14     pub trait B {
15         fn b(self);
16     }
17
18     impl B for () {
19         fn b(self) { }
20     }
21
22     pub trait Unused {
23     }
24 }
25
26 use test::Unused;   // This is really unused, so warning is OK
27                     //~^ WARNING unused import
28 use test::A;        // This is used by the test2::func() through import of super::*
29 use test::B;        // This is used by the test2::func() through import of super::*
30
31 mod test2 {
32     use super::*;
33     pub fn func() {
34         let _ = <()>::a();
35         let _ = ().b();
36         test3::inner_func();
37     }
38     mod test3 {
39         use super::*;
40         pub fn inner_func() {
41             let _ = <()>::a();
42             let _ = ().b();
43         }
44     }
45 }
46
47 fn main() {
48     test2::func();
49 }