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
7 #![deny(unused_extern_crates)]
8 #![allow(unused_variables)]
11 extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate
13 pub extern crate lint_unused_extern_crate4; // no error, it is re-exported
15 extern crate lint_unused_extern_crate3; // no error, it is used
17 extern crate lint_unused_extern_crate2; // no error, the use marks it as used
18 // even if imported objects aren't used
20 extern crate lint_unused_extern_crate as other; // no error, the use * marks it as used
22 #[allow(unused_imports)]
23 use lint_unused_extern_crate2::foo as bar;
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
33 lint_unused_extern_crate3::foo();