Skip to content

Commit

Permalink
Auto merge of #5276 - flip1995:macro_use, r=flip1995
Browse files Browse the repository at this point in the history
Rename macro_use_import -> macro_use_imports

I missed this during review of #5230. We can just do this, without deprecating the old name, since this lint didn't hit nightly rustc yet.

changelog: none
  • Loading branch information
bors committed Mar 5, 2020
2 parents 23d2b21 + 57393b5 commit 3d0f0e3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ Released 2018-09-13
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
[`macro_use_import`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_import
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
[`manual_memcpy`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&loops::WHILE_IMMUTABLE_CONDITION,
&loops::WHILE_LET_LOOP,
&loops::WHILE_LET_ON_ITERATOR,
&macro_use::MACRO_USE_IMPORT,
&macro_use::MACRO_USE_IMPORTS,
&main_recursion::MAIN_RECURSION,
&map_clone::MAP_CLONE,
&map_unit_fn::OPTION_MAP_UNIT_FN,
Expand Down Expand Up @@ -1014,7 +1014,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools));
store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap);
store.register_late_pass(|| box wildcard_imports::WildcardImports);
store.register_early_pass(|| box macro_use::MacroUseImport);
store.register_early_pass(|| box macro_use::MacroUseImports);

store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
Expand Down Expand Up @@ -1082,7 +1082,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
LintId::of(&loops::EXPLICIT_ITER_LOOP),
LintId::of(&macro_use::MACRO_USE_IMPORT),
LintId::of(&macro_use::MACRO_USE_IMPORTS),
LintId::of(&matches::SINGLE_MATCH_ELSE),
LintId::of(&methods::FILTER_MAP),
LintId::of(&methods::FILTER_MAP_NEXT),
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/macro_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ declare_clippy_lint! {
/// #[macro_use]
/// use lazy_static;
/// ```
pub MACRO_USE_IMPORT,
pub MACRO_USE_IMPORTS,
pedantic,
"#[macro_use] is no longer needed"
}

declare_lint_pass!(MacroUseImport => [MACRO_USE_IMPORT]);
declare_lint_pass!(MacroUseImports => [MACRO_USE_IMPORTS]);

impl EarlyLintPass for MacroUseImport {
impl EarlyLintPass for MacroUseImports {
fn check_item(&mut self, ecx: &EarlyContext<'_>, item: &ast::Item) {
if_chain! {
if ecx.sess.opts.edition == Edition::Edition2018;
Expand All @@ -40,7 +40,7 @@ impl EarlyLintPass for MacroUseImport {
let help = format!("use {}::<macro name>", snippet(ecx, use_tree.span, "_"));
span_lint_and_sugg(
ecx,
MACRO_USE_IMPORT,
MACRO_USE_IMPORTS,
mac_attr.span,
msg,
"remove the attribute and import the macro directly, try",
Expand Down
2 changes: 1 addition & 1 deletion src/lintlist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ pub const ALL_LINTS: [Lint; 360] = [
module: "float_literal",
},
Lint {
name: "macro_use_import",
name: "macro_use_imports",
group: "pedantic",
desc: "#[macro_use] is no longer needed",
deprecation: None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --edition 2018
#![warn(clippy::macro_use_import)]
#![warn(clippy::macro_use_imports)]

use std::collections::HashMap;
#[macro_use]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_import.rs:5:1
--> $DIR/macro_use_imports.rs:5:1
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use std::prelude::<macro name>`
|
= note: `-D clippy::macro-use-import` implied by `-D warnings`
= note: `-D clippy::macro-use-imports` implied by `-D warnings`

error: aborting due to previous error

0 comments on commit 3d0f0e3

Please sign in to comment.