]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-rustfix |
8faf50e0 | 2 | // edition:2018 |
f9f354fc | 3 | // check-pass |
b7449926 XL |
4 | // aux-build:remove-extern-crate.rs |
5 | // compile-flags:--extern remove_extern_crate | |
1a4d82fc | 6 | |
b7449926 | 7 | #![warn(rust_2018_idioms)] |
94b46f34 | 8 | |
60c5eb7d | 9 | //~ WARNING unused extern crate |
48663c56 XL |
10 | // Shouldn't suggest changing to `use`, as `another_name` |
11 | // would no longer be added to the prelude which could cause | |
12 | // compilation errors for imports that use `another_name` in other | |
13 | // modules. See #57672. | |
14 | extern crate core as another_name; | |
b7449926 | 15 | use remove_extern_crate; |
94b46f34 | 16 | #[macro_use] |
b7449926 | 17 | extern crate remove_extern_crate as something_else; |
94b46f34 | 18 | |
4462d4a0 XL |
19 | // Shouldn't suggest changing to `use`, as the `alloc` |
20 | // crate is not in the extern prelude - see #54381. | |
21 | extern crate alloc; | |
22 | ||
b7449926 XL |
23 | fn main() { |
24 | another_name::mem::drop(3); | |
25 | another::foo(); | |
26 | remove_extern_crate::foo!(); | |
27 | bar!(); | |
4462d4a0 | 28 | alloc::vec![5]; |
83c7162d | 29 | } |
9e0c209e | 30 | |
b7449926 | 31 | mod another { |
60c5eb7d | 32 | use core; //~ WARNING `extern crate` is not idiomatic |
b7449926 XL |
33 | use remove_extern_crate; |
34 | ||
35 | pub fn foo() { | |
36 | core::mem::drop(4); | |
37 | remove_extern_crate::foo!(); | |
38 | } | |
39 | } |