2018-08-24 21:00:15 +00:00
|
|
|
//@ run-rustfix
|
|
|
|
//@ edition:2018
|
2020-04-20 00:27:28 +00:00
|
|
|
//@ check-pass
|
2018-08-24 21:00:15 +00:00
|
|
|
//@ aux-build:remove-extern-crate.rs
|
2018-09-10 16:41:30 +00:00
|
|
|
//@ compile-flags:--extern remove_extern_crate
|
2018-08-24 21:00:15 +00:00
|
|
|
|
|
|
|
#![warn(rust_2018_idioms)]
|
2023-05-19 09:14:55 +00:00
|
|
|
#![allow(dropping_copy_types)]
|
2023-11-10 02:11:24 +00:00
|
|
|
#![allow(unused_imports)]
|
2018-08-24 21:00:15 +00:00
|
|
|
|
2019-11-06 00:00:00 +00:00
|
|
|
extern crate core; //~ WARNING unused extern crate
|
2019-04-25 07:06:49 +00:00
|
|
|
// Shouldn't suggest changing to `use`, as `another_name`
|
|
|
|
// would no longer be added to the prelude which could cause
|
|
|
|
// compilation errors for imports that use `another_name` in other
|
|
|
|
// modules. See #57672.
|
2018-08-24 21:00:15 +00:00
|
|
|
extern crate core as another_name;
|
|
|
|
use remove_extern_crate;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate remove_extern_crate as something_else;
|
|
|
|
|
2018-09-28 19:54:18 +00:00
|
|
|
// Shouldn't suggest changing to `use`, as the `alloc`
|
|
|
|
// crate is not in the extern prelude - see #54381.
|
|
|
|
extern crate alloc;
|
|
|
|
|
2018-08-24 21:00:15 +00:00
|
|
|
fn main() {
|
|
|
|
another_name::mem::drop(3);
|
|
|
|
another::foo();
|
2023-02-22 20:25:10 +00:00
|
|
|
with_visibility::foo();
|
2018-08-24 21:00:15 +00:00
|
|
|
remove_extern_crate::foo!();
|
|
|
|
bar!();
|
2018-09-28 19:54:18 +00:00
|
|
|
alloc::vec![5];
|
2018-08-24 21:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mod another {
|
2019-11-06 00:00:00 +00:00
|
|
|
extern crate core; //~ WARNING `extern crate` is not idiomatic
|
2018-08-24 21:00:15 +00:00
|
|
|
use remove_extern_crate;
|
|
|
|
|
|
|
|
pub fn foo() {
|
|
|
|
core::mem::drop(4);
|
|
|
|
remove_extern_crate::foo!();
|
|
|
|
}
|
|
|
|
}
|
2023-02-22 20:25:10 +00:00
|
|
|
|
|
|
|
mod with_visibility {
|
|
|
|
pub extern crate core; //~ WARNING `extern crate` is not idiomatic
|
|
|
|
|
|
|
|
pub fn foo() {
|
|
|
|
core::mem::drop(4);
|
|
|
|
remove_extern_crate::foo!();
|
|
|
|
}
|
|
|
|
}
|