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 | 176c34a946df6b096cc2bce19c477fd49c0c9a09 (patch) | |
| tree | b5f6957cd3a5b1f6878dff3058f50b567f59b7b2 | |
| parent | bb063e6e1d9bc70970f25ea42fe275c11092caaa (diff) | |
| download | rust-176c34a946df6b096cc2bce19c477fd49c0c9a09.tar.gz rust-176c34a946df6b096cc2bce19c477fd49c0c9a09.zip | |
Invert the sense of `is_not_macro_export`.
I find it much easier to think about in the positive sense.
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs b/src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs index 7b381fac5f1..743bdb945ef 100644 --- a/src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs +++ b/src/tools/clippy/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 } |
