Skip to content

Commit

Permalink
Auto merge of #39060 - jseyfried:improve_unused, r=nrc
Browse files Browse the repository at this point in the history
Improve unused `extern crate` and unused `#[macro_use]` warnings

This PR
 - adds `unused_imports` warnings for unused `#[macro_use] extern crate` macro imports,
 - improves `unused_extern_crates` warnings (avoids false negatives), and
 - removes unused `#[macro_use]` imports and unused `extern crate`s.

r? @nrc
  • Loading branch information
bors committed Jan 22, 2017
2 parents 1b06375 + 191abc4 commit e5b0829
Show file tree
Hide file tree
Showing 38 changed files with 104 additions and 127 deletions.
17 changes: 0 additions & 17 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/libproc_macro_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ crate-type = ["dylib"]
log = { path = "../liblog" }
rustc_plugin = { path = "../librustc_plugin" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
proc_macro_tokens = { path = "../libproc_macro_tokens" }
1 change: 0 additions & 1 deletion src/libproc_macro_plugin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@

extern crate rustc_plugin;
extern crate syntax;
extern crate syntax_pos;
extern crate proc_macro_tokens;
#[macro_use] extern crate log;

Expand Down
2 changes: 0 additions & 2 deletions src/libproc_macro_tokens/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ crate-type = ["dylib"]

[dependencies]
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
log = { path = "../liblog" }
3 changes: 0 additions & 3 deletions src/libproc_macro_tokens/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern crate syntax;
extern crate syntax_pos;

use syntax::ast::Ident;
use syntax::codemap::DUMMY_SP;
use syntax::parse::token::{self, Token};
Expand Down
2 changes: 0 additions & 2 deletions src/libproc_macro_tokens/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
#![feature(rustc_private)]

extern crate syntax;
extern crate syntax_pos;
#[macro_use] extern crate log;

pub mod build;
pub mod parse;
Expand Down
2 changes: 0 additions & 2 deletions src/libproc_macro_tokens/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

//! Parsing utilities for writing procedural macros.
extern crate syntax;

use syntax::parse::{ParseSess, filemap_to_tts};
use syntax::tokenstream::TokenStream;

Expand Down
1 change: 0 additions & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ crate-type = ["dylib"]

[dependencies]
arena = { path = "../libarena" }
flate = { path = "../libflate" }
fmt_macros = { path = "../libfmt_macros" }
graphviz = { path = "../libgraphviz" }
log = { path = "../liblog" }
Expand Down
9 changes: 1 addition & 8 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#![feature(associated_consts)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(conservative_impl_trait)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
Expand All @@ -39,11 +38,9 @@
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![cfg_attr(test, feature(test))]

extern crate arena;
extern crate core;
extern crate flate;
extern crate fmt_macros;
extern crate getopts;
extern crate graphviz;
Expand All @@ -52,22 +49,18 @@ extern crate rustc_llvm as llvm;
extern crate rustc_back;
extern crate rustc_data_structures;
extern crate serialize;
extern crate collections;
extern crate rustc_const_math;
extern crate rustc_errors as errors;
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
#[macro_use] extern crate syntax_pos;
extern crate syntax_pos;
#[macro_use] #[no_link] extern crate rustc_bitflags;

extern crate serialize as rustc_serialize; // used by deriving

// SNAP:
extern crate rustc_i128;

#[cfg(test)]
extern crate test;

#[macro_use]
mod macros;

Expand Down
1 change: 0 additions & 1 deletion src/librustc_const_eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ crate-type = ["dylib"]
[dependencies]
arena = { path = "../libarena" }
log = { path = "../liblog" }
serialize = { path = "../libserialize" }
rustc = { path = "../librustc" }
rustc_back = { path = "../librustc_back" }
rustc_const_math = { path = "../librustc_const_math" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc_const_eval/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate graphviz;
extern crate syntax_pos;
extern crate serialize as rustc_serialize; // used by deriving

extern crate rustc_i128;

Expand Down
1 change: 0 additions & 1 deletion src/librustc_const_math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
log = { path = "../liblog" }
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
rustc_i128 = { path = "../librustc_i128" }
3 changes: 1 addition & 2 deletions src/librustc_const_math/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#![feature(const_fn)]
#![cfg_attr(not(stage0), feature(i128))]

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
extern crate syntax;

// SNAP: remove use of this crate
extern crate rustc_i128;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ crate-type = ["dylib"]

[dependencies]
arena = { path = "../libarena" }
flate = { path = "../libflate" }
graphviz = { path = "../libgraphviz" }
log = { path = "../liblog" }
proc_macro_plugin = { path = "../libproc_macro_plugin" }
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#![feature(staged_api)]

extern crate arena;
extern crate flate;
extern crate getopts;
extern crate graphviz;
extern crate libc;
Expand All @@ -57,7 +56,6 @@ extern crate serialize;
extern crate rustc_llvm as llvm;
#[macro_use]
extern crate log;
#[macro_use]
extern crate syntax;
extern crate syntax_ext;
extern crate syntax_pos;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
log = { path = "../liblog" }
serialize = { path = "../libserialize" }
syntax_pos = { path = "../libsyntax_pos" }
7 changes: 0 additions & 7 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,9 @@
#![feature(staged_api)]
#![feature(range_contains)]
#![feature(libc)]
#![feature(unicode)]

extern crate serialize;
extern crate term;
#[macro_use]
extern crate log;
#[macro_use]
extern crate libc;
extern crate std_unicode;
extern crate serialize as rustc_serialize; // used by deriving
extern crate syntax_pos;

pub use emitter::ColorConfig;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_incremental/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ serialize = { path = "../libserialize" }
log = { path = "../liblog" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
rustc_i128 = { path = "../librustc_i128" }
4 changes: 1 addition & 3 deletions src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ extern crate rustc_data_structures;
extern crate serialize as rustc_serialize;

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
extern crate syntax;
extern crate syntax_pos;

extern crate rustc_i128;

const ATTR_DIRTY: &'static str = "rustc_dirty";
const ATTR_CLEAN: &'static str = "rustc_clean";
const ATTR_DIRTY_METADATA: &'static str = "rustc_metadata_dirty";
Expand Down
1 change: 0 additions & 1 deletion src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#![feature(slice_patterns)]
#![feature(staged_api)]

#[macro_use]
extern crate syntax;
#[macro_use]
extern crate rustc;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ crate-type = ["dylib"]
graphviz = { path = "../libgraphviz" }
log = { path = "../liblog" }
rustc = { path = "../librustc" }
rustc_back = { path = "../librustc_back" }
rustc_const_eval = { path = "../librustc_const_eval" }
rustc_const_math = { path = "../librustc_const_math" }
rustc_data_structures = { path = "../librustc_data_structures" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extern crate graphviz as dot;
#[macro_use]
extern crate rustc;
extern crate rustc_data_structures;
extern crate rustc_back;
#[macro_use]
#[no_link]
extern crate rustc_bitflags;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#![feature(staged_api)]
#![feature(rustc_private)]

extern crate core;
#[macro_use]
extern crate rustc;
extern crate rustc_const_eval;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
log = { path = "../liblog" }
rustc = { path = "../librustc" }
rustc_back = { path = "../librustc_back" }
rustc_bitflags = { path = "../librustc_bitflags" }
rustc_metadata = { path = "../librustc_metadata" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_plugin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
#[macro_use] #[no_link] extern crate rustc_bitflags;

extern crate rustc;
extern crate rustc_back;
Expand Down
Loading

0 comments on commit e5b0829

Please sign in to comment.