Skip to content

Commit e7aa139

Browse files
committed
Use sort_by_cached_key for partitioning
1 parent 2cc52f0 commit e7aa139

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: src/librustc_mir/monomorphize/partitioning.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@ pub trait CodegenUnitExt<'tcx> {
189189
}, item.symbol_name(tcx))
190190
}
191191

192-
let items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
193-
let mut items : Vec<_> = items.iter()
194-
.map(|il| (il, item_sort_key(tcx, il.0))).collect();
195-
items.sort_by(|&(_, ref key1), &(_, ref key2)| key1.cmp(key2));
196-
items.into_iter().map(|(&item_linkage, _)| item_linkage).collect()
192+
let mut items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
193+
items.sort_by_cached_key(|&(i, _)| item_sort_key(tcx, i));
194+
items
197195
}
198196
}
199197

0 commit comments

Comments
 (0)