diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-05-04 11:25:31 -0700 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-05-04 14:52:53 -0700 |
| commit | 01791dee8a6c93bdbc9e3c9369b6b5f0ee35e5c8 (patch) | |
| tree | ce5b33cc62087f086633b5ffaa881f79838ee35b /src/test | |
| parent | dafbdeb384318227ec9e5117a022447bbd50467b (diff) | |
| download | rust-01791dee8a6c93bdbc9e3c9369b6b5f0ee35e5c8.tar.gz rust-01791dee8a6c93bdbc9e3c9369b6b5f0ee35e5c8.zip | |
Add test
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui-fulldeps/unnecessary-extern-crate.rs | 55 | ||||
| -rw-r--r-- | src/test/ui-fulldeps/unnecessary-extern-crate.stderr | 68 |
2 files changed, 123 insertions, 0 deletions
diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.rs b/src/test/ui-fulldeps/unnecessary-extern-crate.rs new file mode 100644 index 00000000000..9d678d91578 --- /dev/null +++ b/src/test/ui-fulldeps/unnecessary-extern-crate.rs @@ -0,0 +1,55 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(unnecessary_extern_crate)] +#![feature(alloc, test, libc)] + +extern crate alloc; +//~^ ERROR `extern crate` is unnecessary in the new edition +//~| HELP remove +extern crate alloc as x; +//~^ ERROR `extern crate` is unnecessary in the new edition +//~| HELP use `use` + +#[macro_use] +extern crate test; +pub extern crate test as y; +//~^ ERROR `extern crate` is unnecessary in the new edition +//~| HELP use `pub use` +pub extern crate libc; +//~^ ERROR `extern crate` is unnecessary in the new edition +//~| HELP use `pub use` + + +mod foo { + extern crate alloc; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `use` + extern crate alloc as x; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `use` + pub extern crate test; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `pub use` + pub extern crate test as y; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `pub use` + mod bar { + extern crate alloc; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `use` + extern crate alloc as x; + //~^ ERROR `extern crate` is unnecessary in the new edition + //~| HELP use `use` + } +} + + +fn main() {} diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.stderr b/src/test/ui-fulldeps/unnecessary-extern-crate.stderr new file mode 100644 index 00000000000..7718808be58 --- /dev/null +++ b/src/test/ui-fulldeps/unnecessary-extern-crate.stderr @@ -0,0 +1,68 @@ +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:14:1 + | +LL | extern crate alloc; + | ^^^^^^^^^^^^^^^^^^^ help: remove it + | +note: lint level defined here + --> $DIR/unnecessary-extern-crate.rs:11:9 + | +LL | #![deny(unnecessary_extern_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:17:1 + | +LL | extern crate alloc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:23:1 + | +LL | pub extern crate test as y; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:26:1 + | +LL | pub extern crate libc; + | ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:32:5 + | +LL | extern crate alloc; + | ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:35:5 + | +LL | extern crate alloc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:38:5 + | +LL | pub extern crate test; + | ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:41:5 + | +LL | pub extern crate test as y; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:45:9 + | +LL | extern crate alloc; + | ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc` + +error: `extern crate` is unnecessary in the new edition + --> $DIR/unnecessary-extern-crate.rs:48:9 + | +LL | extern crate alloc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x` + +error: aborting due to 10 previous errors + |
