1
Fork 0

Two minor changes for readability and efficiency

This commit is contained in:
Fabian Wolff 2021-05-17 13:56:11 +02:00
parent 4efa4a5273
commit 7b301985fa
2 changed files with 4 additions and 8 deletions

View file

@ -100,12 +100,11 @@ impl LanguageItemCollector<'tcx> {
}
fn collect_item(&mut self, item_index: usize, item_def_id: DefId) {
let lang_item = LangItem::from_u32(item_index as u32).unwrap();
let name = lang_item.name();
// Check for duplicates.
if let Some(original_def_id) = self.items.items[item_index] {
if original_def_id != item_def_id {
let lang_item = LangItem::from_u32(item_index as u32).unwrap();
let name = lang_item.name();
let mut err = match self.tcx.hir().span_if_local(item_def_id) {
Some(span) => struct_span_err!(
self.tcx.sess,