mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
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](https://github.com/rust-lang/rust/pull/110040#pullrequestreview-1469452191).) 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.
This commit is contained in:
commit
a5561eb4d5
@ -107,6 +107,10 @@ impl<T, I: Iterator<Item = T>> UnordItems<T, I> {
|
|||||||
{
|
{
|
||||||
UnordItems(self.0.flat_map(f))
|
UnordItems(self.0.flat_map(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn collect<C: From<UnordItems<T, I>>>(self) -> C {
|
||||||
|
self.into()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> UnordItems<T, std::iter::Empty<T>> {
|
impl<T> UnordItems<T, std::iter::Empty<T>> {
|
||||||
@ -161,10 +165,6 @@ impl<T: Ord, I: Iterator<Item = T>> UnordItems<T, I> {
|
|||||||
items.sort_by_cached_key(|x| x.to_stable_hash_key(hcx));
|
items.sort_by_cached_key(|x| x.to_stable_hash_key(hcx));
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect<C: From<UnordItems<T, I>>>(self) -> C {
|
|
||||||
self.into()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is a set collection type that tries very hard to not expose
|
/// This is a set collection type that tries very hard to not expose
|
||||||
|
@ -198,7 +198,7 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
|
|||||||
let (name, mut auto) = self.auto_labels(item_id, attr);
|
let (name, mut auto) = self.auto_labels(item_id, attr);
|
||||||
let except = self.except(attr);
|
let except = self.except(attr);
|
||||||
let loaded_from_disk = self.loaded_from_disk(attr);
|
let loaded_from_disk = self.loaded_from_disk(attr);
|
||||||
for e in except.items().map(|x| x.as_str()).into_sorted_stable_ord() {
|
for e in except.items().into_sorted_stable_ord() {
|
||||||
if !auto.remove(e) {
|
if !auto.remove(e) {
|
||||||
self.tcx.sess.emit_fatal(errors::AssertionAuto { span: attr.span, name, e });
|
self.tcx.sess.emit_fatal(errors::AssertionAuto { span: attr.span, name, e });
|
||||||
}
|
}
|
||||||
@ -377,17 +377,15 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
self.checked_attrs.insert(attr.id);
|
self.checked_attrs.insert(attr.id);
|
||||||
for label in assertion.clean.items().map(|x| x.as_str()).into_sorted_stable_ord() {
|
for label in assertion.clean.items().into_sorted_stable_ord() {
|
||||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||||
self.assert_clean(item_span, dep_node);
|
self.assert_clean(item_span, dep_node);
|
||||||
}
|
}
|
||||||
for label in assertion.dirty.items().map(|x| x.as_str()).into_sorted_stable_ord() {
|
for label in assertion.dirty.items().into_sorted_stable_ord() {
|
||||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||||
self.assert_dirty(item_span, dep_node);
|
self.assert_dirty(item_span, dep_node);
|
||||||
}
|
}
|
||||||
for label in
|
for label in assertion.loaded_from_disk.items().into_sorted_stable_ord() {
|
||||||
assertion.loaded_from_disk.items().map(|x| x.as_str()).into_sorted_stable_ord()
|
|
||||||
{
|
|
||||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||||
self.assert_loaded_from_disk(item_span, dep_node);
|
self.assert_loaded_from_disk(item_span, dep_node);
|
||||||
}
|
}
|
||||||
|
@ -855,12 +855,11 @@ fn all_except_most_recent(
|
|||||||
let most_recent = deletion_candidates.items().map(|(&(timestamp, _), _)| timestamp).max();
|
let most_recent = deletion_candidates.items().map(|(&(timestamp, _), _)| timestamp).max();
|
||||||
|
|
||||||
if let Some(most_recent) = most_recent {
|
if let Some(most_recent) = most_recent {
|
||||||
UnordMap::from(
|
|
||||||
deletion_candidates
|
deletion_candidates
|
||||||
.into_items()
|
.into_items()
|
||||||
.filter(|&((timestamp, _), _)| timestamp != most_recent)
|
.filter(|&((timestamp, _), _)| timestamp != most_recent)
|
||||||
.map(|((_, path), lock)| (path, lock)),
|
.map(|((_, path), lock)| (path, lock))
|
||||||
)
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
UnordMap::default()
|
UnordMap::default()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user