Remove unneeded Option<Symbol> in foreign_items

This commit is contained in:
Guillaume Gomez 2023-07-17 20:33:54 +02:00
parent c845a53aa2
commit afec6d242b
2 changed files with 3 additions and 4 deletions

View File

@ -90,7 +90,7 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
} }
v v
})); }));
items.extend(doc.inlined_foreigns.values().flat_map(|(res, renamed, local_import_id)| { items.extend(doc.inlined_foreigns.iter().flat_map(|((_, renamed), (res, local_import_id))| {
let Some(def_id) = res.opt_def_id() else { return Vec::new() }; let Some(def_id) = res.opt_def_id() else { return Vec::new() };
let name = renamed.unwrap_or_else(|| cx.tcx.item_name(def_id)); let name = renamed.unwrap_or_else(|| cx.tcx.item_name(def_id));
let import = cx.tcx.hir().expect_item(*local_import_id); let import = cx.tcx.hir().expect_item(*local_import_id);

View File

@ -36,8 +36,7 @@ pub(crate) struct Module<'hir> {
(&'hir hir::Item<'hir>, Option<Symbol>, Option<LocalDefId>), (&'hir hir::Item<'hir>, Option<Symbol>, Option<LocalDefId>),
>, >,
/// Same as for `items`. /// Same as for `items`.
pub(crate) inlined_foreigns: pub(crate) inlined_foreigns: FxIndexMap<(DefId, Option<Symbol>), (Res, LocalDefId)>,
FxIndexMap<(DefId, Option<Symbol>), (Res, Option<Symbol>, LocalDefId)>,
pub(crate) foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>, pub(crate) foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
} }
@ -295,7 +294,7 @@ fn maybe_inline_local(
.last_mut() .last_mut()
.unwrap() .unwrap()
.inlined_foreigns .inlined_foreigns
.insert((ori_res_did, renamed), (res, renamed, def_id)); .insert((ori_res_did, renamed), (res, def_id));
return true; return true;
}; };