]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/redundant_pub_crate.rs
Add 'library/portable-simd/' from commit '1ce1c645cf27c4acdefe6ec8a11d1f0491954a99'
[rust.git] / src / tools / clippy / clippy_lints / src / redundant_pub_crate.rs
index ed2e1f90fa597a76737ddfaf9b38fc7bfd1cebc8..919d4e11e5a060637fb35ab2012a802f80f47aa6 100644 (file)
@@ -41,25 +41,23 @@ pub struct RedundantPubCrate {
 impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate {
     fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
         if let VisibilityKind::Crate { .. } = item.vis.node {
-            if !cx.access_levels.is_exported(item.def_id) {
-                if let Some(false) = self.is_exported.last() {
-                    let span = item.span.with_hi(item.ident.span.hi());
-                    let descr = cx.tcx.def_kind(item.def_id).descr(item.def_id.to_def_id());
-                    span_lint_and_then(
-                        cx,
-                        REDUNDANT_PUB_CRATE,
-                        span,
-                        &format!("pub(crate) {} inside private module", descr),
-                        |diag| {
-                            diag.span_suggestion(
-                                item.vis.span,
-                                "consider using",
-                                "pub".to_string(),
-                                Applicability::MachineApplicable,
-                            );
-                        },
-                    );
-                }
+            if !cx.access_levels.is_exported(item.def_id) && self.is_exported.last() == Some(&false) {
+                let span = item.span.with_hi(item.ident.span.hi());
+                let descr = cx.tcx.def_kind(item.def_id).descr(item.def_id.to_def_id());
+                span_lint_and_then(
+                    cx,
+                    REDUNDANT_PUB_CRATE,
+                    span,
+                    &format!("pub(crate) {} inside private module", descr),
+                    |diag| {
+                        diag.span_suggestion(
+                            item.vis.span,
+                            "consider using",
+                            "pub".to_string(),
+                            Applicability::MachineApplicable,
+                        );
+                    },
+                );
             }
         }