Auto merge of #12450 - cookie-s:fix-optopt-duplicate-diags, r=llogiq

[`option_option`]: Fix duplicate diagnostics

Relates to #12379

This `option_option` lint change skips checks against `ty`s inside `field_def`s defined by external macro to prevent duplicate diagnostics to the same span `ty` by multiple `Struct` definitions.

---

changelog: [`option_option`]: Fix duplicate diagnostics
This commit is contained in:
bors 2024-03-17 07:51:49 +00:00
commit d202eb653b
3 changed files with 17 additions and 15 deletions

View file

@ -392,6 +392,10 @@ impl<'tcx> LateLintPass<'tcx> for Types {
}
fn check_field_def(&mut self, cx: &LateContext<'tcx>, field: &hir::FieldDef<'tcx>) {
if field.span.from_expansion() {
return;
}
let is_exported = cx.effective_visibilities.is_exported(field.def_id);
self.check_ty(