about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2017-01-14 08:58:50 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2017-01-22 01:31:00 +0000
commit356fa2c5db18beb5d4787ea2997f555504bb26dc (patch)
treed8b35821e186802f71ced76b55927c4eaf8a0526 /src/test
parent2efec3c18050b4093ed8be9537145bdc2a50f7e7 (diff)
downloadrust-356fa2c5db18beb5d4787ea2997f555504bb26dc.tar.gz
rust-356fa2c5db18beb5d4787ea2997f555504bb26dc.zip
Warn on unused `#[macro_use]` imports.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/imports/unused-macro-use.rs21
-rw-r--r--src/test/compile-fail/lint-unused-extern-crate.rs2
2 files changed, 21 insertions, 2 deletions
diff --git a/src/test/compile-fail/imports/unused-macro-use.rs b/src/test/compile-fail/imports/unused-macro-use.rs
new file mode 100644
index 00000000000..365521970cd
--- /dev/null
+++ b/src/test/compile-fail/imports/unused-macro-use.rs
@@ -0,0 +1,21 @@
+// Copyright 2016 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(unused)]
+
+#[macro_use] //~ ERROR unused `#[macro_use]` import
+extern crate core;
+
+#[macro_use(
+    panic //~ ERROR unused `#[macro_use]` import
+)]
+extern crate core as core_2;
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs
index 515e3b833d9..40671353f8a 100644
--- a/src/test/compile-fail/lint-unused-extern-crate.rs
+++ b/src/test/compile-fail/lint-unused-extern-crate.rs
@@ -26,8 +26,6 @@ extern crate rand; // no error, the use marks it as used
 
 extern crate lint_unused_extern_crate as other; // no error, the use * marks it as used
 
-#[macro_use] extern crate core; // no error, the `#[macro_use]` marks it as used
-
 #[allow(unused_imports)]
 use rand::isaac::IsaacRng;