Skip to content

Commit abc8eb7

Browse files
committed
Drop vis in FieldDef.
1 parent fabc26f commit abc8eb7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clippy_lints/src/exhaustive_items.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ impl LateLintPass<'_> for ExhaustiveItems {
7878
if !attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
7979
then {
8080
let (lint, msg) = if let ItemKind::Struct(ref v, ..) = item.kind {
81-
if v.fields().iter().any(|f| !f.vis.node.is_pub()) {
81+
if v.fields().iter().any(|f| {
82+
let def_id = cx.tcx.hir().local_def_id(f.hir_id);
83+
!cx.tcx.visibility(def_id).is_public()
84+
}) {
8285
// skip structs with private fields
8386
return;
8487
}

0 commit comments

Comments
 (0)