fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2// edition:2018 3// check-pass 4// aux-build:remove-extern-crate.rs 5// compile-flags:--extern remove_extern_crate 6 7#![warn(rust_2018_idioms)] 8#![allow(dropping_copy_types)] 9 10 //~ WARNING unused extern crate 11// Shouldn't suggest changing to `use`, as `another_name` 12// would no longer be added to the prelude which could cause 13// compilation errors for imports that use `another_name` in other 14// modules. See #57672. 15extern crate core as another_name; 16use remove_extern_crate; 17#[macro_use] 18extern crate remove_extern_crate as something_else; 19 20// Shouldn't suggest changing to `use`, as the `alloc` 21// crate is not in the extern prelude - see #54381. 22extern crate alloc; 23 24fn main() { 25 another_name::mem::drop(3); 26 another::foo(); 27 with_visibility::foo(); 28 remove_extern_crate::foo!(); 29 bar!(); 30 alloc::vec![5]; 31} 32 33mod another { 34 use core; //~ WARNING `extern crate` is not idiomatic 35 use remove_extern_crate; 36 37 pub fn foo() { 38 core::mem::drop(4); 39 remove_extern_crate::foo!(); 40 } 41} 42 43mod with_visibility { 44 pub use core; //~ WARNING `extern crate` is not idiomatic 45 46 pub fn foo() { 47 core::mem::drop(4); 48 remove_extern_crate::foo!(); 49 } 50}