Skip to content

Commit 2d1b77e

Browse files
committed
clippy: Update for switch to MacroKinds
This updates two clippy lints which had exceptions for `MacroKind::Bang` macros to extend those exceptions to any macro, now that a macro_rules macro can be any kind of macro.
1 parent df2de34 commit 2d1b77e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/tools/clippy/clippy_lints/src/item_name_repetitions.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_data_structures::fx::FxHashSet;
88
use rustc_hir::{EnumDef, FieldDef, Item, ItemKind, OwnerId, QPath, TyKind, Variant, VariantData};
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_session::impl_lint_pass;
11-
use rustc_span::MacroKind;
1211
use rustc_span::symbol::Symbol;
1312

1413
declare_clippy_lint! {
@@ -503,8 +502,8 @@ impl LateLintPass<'_> for ItemNameRepetitions {
503502
);
504503
}
505504

506-
let is_macro_rule = matches!(item.kind, ItemKind::Macro(_, _, MacroKind::Bang));
507-
if both_are_public && item_camel.len() > mod_camel.len() && !is_macro_rule {
505+
let is_macro = matches!(item.kind, ItemKind::Macro(_, _, _));
506+
if both_are_public && item_camel.len() > mod_camel.len() && !is_macro {
508507
let matching = count_match_start(mod_camel, &item_camel);
509508
let rmatching = count_match_end(mod_camel, &item_camel);
510509
let nchars = mod_camel.chars().count();

src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_lint::{LateContext, LateLintPass};
77
use rustc_middle::ty;
88
use rustc_session::impl_lint_pass;
99
use rustc_span::def_id::CRATE_DEF_ID;
10-
use rustc_span::hygiene::MacroKind;
1110

1211
declare_clippy_lint! {
1312
/// ### What it does
@@ -89,7 +88,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate {
8988
// We ignore macro exports. And `ListStem` uses, which aren't interesting.
9089
fn is_ignorable_export<'tcx>(item: &'tcx Item<'tcx>) -> bool {
9190
if let ItemKind::Use(path, kind) = item.kind {
92-
let ignore = matches!(path.res.macro_ns, Some(Res::Def(DefKind::Macro(MacroKind::Bang), _)))
91+
let ignore = matches!(path.res.macro_ns, Some(Res::Def(DefKind::Macro(_), _)))
9392
|| kind == UseKind::ListStem;
9493
if ignore {
9594
return true;

0 commit comments

Comments
 (0)