Skip to content

Commit a5561eb

Browse files
Rollup merge of #112538 - ndrewxie:issue-84447-partial-1, r=compiler-errors
Removed unnecessary &String -> &str, now that &String implements StableOrd as well Applied a few nits suggested by lcnr to PR #110040 (nits can be found [here](#110040 (review)).) Making a new PR because the old one was already merged, and given that this just applies changes that were already suggested, reviewing it should be fairly open-and-shut.
2 parents 536635c + 0cac845 commit a5561eb

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

compiler/rustc_data_structures/src/unord.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ impl<T, I: Iterator<Item = T>> UnordItems<T, I> {
107107
{
108108
UnordItems(self.0.flat_map(f))
109109
}
110+
111+
pub fn collect<C: From<UnordItems<T, I>>>(self) -> C {
112+
self.into()
113+
}
110114
}
111115

112116
impl<T> UnordItems<T, std::iter::Empty<T>> {
@@ -161,10 +165,6 @@ impl<T: Ord, I: Iterator<Item = T>> UnordItems<T, I> {
161165
items.sort_by_cached_key(|x| x.to_stable_hash_key(hcx));
162166
items
163167
}
164-
165-
pub fn collect<C: From<UnordItems<T, I>>>(self) -> C {
166-
self.into()
167-
}
168168
}
169169

170170
/// This is a set collection type that tries very hard to not expose

compiler/rustc_incremental/src/persist/dirty_clean.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
198198
let (name, mut auto) = self.auto_labels(item_id, attr);
199199
let except = self.except(attr);
200200
let loaded_from_disk = self.loaded_from_disk(attr);
201-
for e in except.items().map(|x| x.as_str()).into_sorted_stable_ord() {
201+
for e in except.items().into_sorted_stable_ord() {
202202
if !auto.remove(e) {
203203
self.tcx.sess.emit_fatal(errors::AssertionAuto { span: attr.span, name, e });
204204
}
@@ -377,17 +377,15 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
377377
continue;
378378
};
379379
self.checked_attrs.insert(attr.id);
380-
for label in assertion.clean.items().map(|x| x.as_str()).into_sorted_stable_ord() {
380+
for label in assertion.clean.items().into_sorted_stable_ord() {
381381
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
382382
self.assert_clean(item_span, dep_node);
383383
}
384-
for label in assertion.dirty.items().map(|x| x.as_str()).into_sorted_stable_ord() {
384+
for label in assertion.dirty.items().into_sorted_stable_ord() {
385385
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
386386
self.assert_dirty(item_span, dep_node);
387387
}
388-
for label in
389-
assertion.loaded_from_disk.items().map(|x| x.as_str()).into_sorted_stable_ord()
390-
{
388+
for label in assertion.loaded_from_disk.items().into_sorted_stable_ord() {
391389
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
392390
self.assert_loaded_from_disk(item_span, dep_node);
393391
}

compiler/rustc_incremental/src/persist/fs.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -855,12 +855,11 @@ fn all_except_most_recent(
855855
let most_recent = deletion_candidates.items().map(|(&(timestamp, _), _)| timestamp).max();
856856

857857
if let Some(most_recent) = most_recent {
858-
UnordMap::from(
859-
deletion_candidates
860-
.into_items()
861-
.filter(|&((timestamp, _), _)| timestamp != most_recent)
862-
.map(|((_, path), lock)| (path, lock)),
863-
)
858+
deletion_candidates
859+
.into_items()
860+
.filter(|&((timestamp, _), _)| timestamp != most_recent)
861+
.map(|((_, path), lock)| (path, lock))
862+
.collect()
864863
} else {
865864
UnordMap::default()
866865
}

0 commit comments

Comments
 (0)