1
Fork 0

Add pub struct with allow(dead_code) into worklist

This commit is contained in:
r0cky 2024-06-12 17:58:20 +08:00
parent 336e6ab3b3
commit 64450732be
2 changed files with 34 additions and 1 deletions

View file

@ -898,7 +898,7 @@ fn create_and_seed_worklist(
match tcx.def_kind(id) {
DefKind::Impl { .. } => false,
DefKind::AssocConst | DefKind::AssocFn => !matches!(tcx.associated_item(id).container, AssocItemContainer::ImplContainer),
DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()),
DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()) || has_allow_dead_code_or_lang_attr(tcx, id).is_some(),
_ => true
})
.map(|id| (id, ComesFromAllowExpect::No))