]> git.lizzy.rs Git - rust.git/blob - tests/ui/imports/unused-imports-in-test-mode.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / imports / unused-imports-in-test-mode.rs
1 // compile-flags: --test
2
3 #![deny(unused_imports)]
4
5 use std::io::BufRead; //~ ERROR unused import: `std::io::BufRead`
6
7 fn a() {}
8 fn b() {}
9
10 mod test {
11     use super::a;
12
13     #[test]
14     fn foo() {
15         a();
16         use crate::b; //~ ERROR unused import: `crate::b`
17     }
18 }
19
20 mod tests {
21     use super::a;
22
23     #[test]
24     fn foo() {
25         a();
26         use crate::b; //~ ERROR unused import: `crate::b`
27     }
28 }
29
30 mod test_a {
31     use super::a;
32
33     #[test]
34     fn foo() {
35         a();
36         use crate::b; //~ ERROR unused import: `crate::b`
37     }
38 }
39
40 mod a_test {
41     use super::a;
42
43     #[test]
44     fn foo() {
45         a();
46         use crate::b; //~ ERROR unused import: `crate::b`
47     }
48 }
49
50 mod tests_a {
51     use super::a;
52
53     #[test]
54     fn foo() {
55         a();
56         use crate::b; //~ ERROR unused import: `crate::b`
57     }
58 }
59
60 mod a_tests {
61     use super::a;
62
63     #[test]
64     fn foo() {
65         a();
66         use crate::b; //~ ERROR unused import: `crate::b`
67     }
68 }
69
70 mod fastest_search {
71     use super::a;
72
73     #[test]
74     fn foo() {
75         a();
76         use crate::b; //~ ERROR unused import: `crate::b`
77     }
78 }
79
80 #[cfg(test)]
81 mod test_has_attr {
82     use super::a;
83
84     #[test]
85     fn foo() {
86         a();
87         use crate::b; //~ ERROR unused import: `crate::b`
88     }
89 }
90
91 mod test_has_no_attr {
92     #[cfg(test)]
93     use super::a;
94
95     #[test]
96     fn foo() {
97         a();
98         use crate::b; //~ ERROR unused import: `crate::b`
99     }
100 }
101
102 fn main() {}