Open
Description
A new function tcx.get_diagnostic_name
is available (after the next sync) and we should migrate existing code to use it in any case that multiple queries can be reduced to one.
For example (this is just one of a few different patterns that can be refactored):
// before
cx.tcx.is_diagnostic_item(sym::Vec, def_id)
|| cx.tcx.is_diagnostic_item(sym::HashMap, def_id)
|| cx.tcx.is_diagnostic_item(sym::HashSet, def_id)
// after
matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::Vec | sym::HashMap | sym::HashSet))
Also look for type_is_diagnotic_item
calls which can be refactored using ty.ty_adt_def()?.did
.