]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rust-2018/remove-extern-crate.fixed
Do not suggest use over extern crate w/ alias.
[rust.git] / src / test / ui / rust-2018 / remove-extern-crate.fixed
1 // run-rustfix
2 // edition:2018
3 // compile-pass
4 // aux-build:remove-extern-crate.rs
5 // compile-flags:--extern remove_extern_crate
6
7 #![warn(rust_2018_idioms)]
8
9
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;
15 use remove_extern_crate;
16 #[macro_use]
17 extern crate remove_extern_crate as something_else;
18
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
23 fn main() {
24     another_name::mem::drop(3);
25     another::foo();
26     remove_extern_crate::foo!();
27     bar!();
28     alloc::vec![5];
29 }
30
31 mod another {
32     use core;
33     use remove_extern_crate;
34
35     pub fn foo() {
36         core::mem::drop(4);
37         remove_extern_crate::foo!();
38     }
39 }