Store a LocalDefId in hir::Variant & hir::Field.

This commit is contained in:
Camille GILLOT 2022-11-06 19:46:55 +00:00
parent 7ddd321ecd
commit e6ef478877
2 changed files with 4 additions and 4 deletions

View file

@ -157,10 +157,10 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
&& def.variants.len() > 1
{
let mut iter = def.variants.iter().filter_map(|v| {
let id = cx.tcx.hir().local_def_id(v.id);
(matches!(v.data, hir::VariantData::Unit(_))
let id = cx.tcx.hir().local_def_id(v.hir_id);
(matches!(v.data, hir::VariantData::Unit(..))
&& v.ident.as_str().starts_with('_')
&& is_doc_hidden(cx.tcx.hir().attrs(v.id)))
&& is_doc_hidden(cx.tcx.hir().attrs(v.hir_id)))
.then_some((id, v.span))
});
if let Some((id, span)) = iter.next()

View file

@ -199,7 +199,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
}
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx hir::Variant<'_>) {
let attrs = cx.tcx.hir().attrs(v.id);
let attrs = cx.tcx.hir().attrs(v.hir_id);
if !is_from_proc_macro(cx, v) {
self.check_missing_docs_attrs(cx, attrs, v.span, "a", "variant");
}