]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/lint-unused-extern-crate.rs
Rollup merge of #87180 - notriddle:notriddle/sidebar-keyboard-mobile, r=GuillaumeGomez
[rust.git] / src / test / ui / lint / lint-unused-extern-crate.rs
1 // aux-build:lint_unused_extern_crate.rs
2 // aux-build:lint_unused_extern_crate2.rs
3 // aux-build:lint_unused_extern_crate3.rs
4 // aux-build:lint_unused_extern_crate4.rs
5 // aux-build:lint_unused_extern_crate5.rs
6
7 #![deny(unused_extern_crates)]
8 #![allow(unused_variables)]
9 #![allow(deprecated)]
10
11 extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate
12
13 pub extern crate lint_unused_extern_crate4; // no error, it is re-exported
14
15 extern crate lint_unused_extern_crate3; // no error, it is used
16
17 extern crate lint_unused_extern_crate2; // no error, the use marks it as used
18                                         // even if imported objects aren't used
19
20 extern crate lint_unused_extern_crate as other; // no error, the use * marks it as used
21
22 #[allow(unused_imports)]
23 use lint_unused_extern_crate2::foo as bar;
24
25 use other::*;
26
27 mod foo {
28     // Test that this is unused even though an earlier `extern crate` is used.
29     extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate
30 }
31
32 fn main() {
33     lint_unused_extern_crate3::foo();
34     let y = foo();
35 }