2018-08-24 16:00:15 -05:00
|
|
|
// run-rustfix
|
|
|
|
// edition:2018
|
2020-04-19 19:27:28 -05:00
|
|
|
// check-pass
|
2018-08-24 16:00:15 -05:00
|
|
|
// aux-build:remove-extern-crate.rs
|
2018-09-10 11:41:30 -05:00
|
|
|
// compile-flags:--extern remove_extern_crate
|
2018-08-24 16:00:15 -05:00
|
|
|
|
|
|
|
#![warn(rust_2018_idioms)]
|
2023-05-19 04:14:55 -05:00
|
|
|
#![allow(dropping_copy_types)]
|
2018-08-24 16:00:15 -05:00
|
|
|
|
2019-11-05 18:00:00 -06:00
|
|
|
extern crate core; //~ WARNING unused extern crate
|
2019-04-25 02:06:49 -05: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 16:00:15 -05:00
|
|
|
extern crate core as another_name;
|
|
|
|
use remove_extern_crate;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate remove_extern_crate as something_else;
|
|
|
|
|
2018-09-28 14:54:18 -05: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 16:00:15 -05:00
|
|
|
fn main() {
|
|
|
|
another_name::mem::drop(3);
|
|
|
|
another::foo();
|
2023-02-22 14:25:10 -06:00
|
|
|
with_visibility::foo();
|
2018-08-24 16:00:15 -05:00
|
|
|
remove_extern_crate::foo!();
|
|
|
|
bar!();
|
2018-09-28 14:54:18 -05:00
|
|
|
alloc::vec![5];
|
2018-08-24 16:00:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod another {
|
2019-11-05 18:00:00 -06:00
|
|
|
extern crate core; //~ WARNING `extern crate` is not idiomatic
|
2018-08-24 16:00:15 -05:00
|
|
|
use remove_extern_crate;
|
|
|
|
|
|
|
|
pub fn foo() {
|
|
|
|
core::mem::drop(4);
|
|
|
|
remove_extern_crate::foo!();
|
|
|
|
}
|
|
|
|
}
|
2023-02-22 14:25:10 -06: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!();
|
|
|
|
}
|
|
|
|
}
|