diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-05-30 01:37:17 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-06-02 09:53:35 +1000 |
| commit | abf5d4c33436a0ecb85b9756649979476971612b (patch) | |
| tree | 22667f208cae0c75766fed8802031ad214ac63e1 | |
| parent | 61465edac2a19295f7092dba246dbf3d07c35a03 (diff) | |
| download | rust-abf5d4c33436a0ecb85b9756649979476971612b.tar.gz rust-abf5d4c33436a0ecb85b9756649979476971612b.zip | |
Invert the sense of `is_not_macro_export`.
I find it much easier to think about in the positive sense.
| -rw-r--r-- | clippy_lints/src/redundant_pub_crate.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clippy_lints/src/redundant_pub_crate.rs b/clippy_lints/src/redundant_pub_crate.rs index 7b381fac5f1..743bdb945ef 100644 --- a/clippy_lints/src/redundant_pub_crate.rs +++ b/clippy_lints/src/redundant_pub_crate.rs @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate { if cx.tcx.visibility(item.owner_id.def_id) == ty::Visibility::Restricted(CRATE_DEF_ID.to_def_id()) && !cx.effective_visibilities.is_exported(item.owner_id.def_id) && self.is_exported.last() == Some(&false) - && is_not_macro_export(item) + && !is_macro_export(item) && !item.span.in_external_macro(cx.sess().source_map()) { let span = item @@ -86,18 +86,18 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate { } } -fn is_not_macro_export<'tcx>(item: &'tcx Item<'tcx>) -> bool { +fn is_macro_export<'tcx>(item: &'tcx Item<'tcx>) -> bool { if let ItemKind::Use(path, _) = item.kind { if path .res .iter() .all(|res| matches!(res, Res::Def(DefKind::Macro(MacroKind::Bang), _))) { - return false; + return true; } } else if let ItemKind::Macro(..) = item.kind { - return false; + return true; } - true + false } |
