This commit is contained in:
Philipp Hansch 2020-04-26 10:12:14 +02:00
parent 07dd5fada9
commit 5b1622b324
No known key found for this signature in database
GPG Key ID: 2B4399C4BF4DCBDE

View File

@ -45,11 +45,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantPubCrate {
if !cx.access_levels.is_exported(item.hir_id) {
if let Some(false) = self.is_exported.last() {
let span = item.span.with_hi(item.ident.span.hi());
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
let descr = cx.tcx.def_kind(def_id).descr(def_id.to_def_id());
span_lint_and_then(
cx,
REDUNDANT_PUB_CRATE,
span,
&format!("pub(crate) {} inside private module", item.kind.descr()),
&format!("pub(crate) {} inside private module", descr),
|diag| {
diag.span_suggestion(
item.vis.span,