Skip to content

Commit b2e3a56

Browse files
committed
overhaul
1 parent eeeddde commit b2e3a56

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

crates/formality-prove/src/prove/prove_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use formality_types::{
22
cast::{Downcast, Upcast, Upcasted},
3-
collections::Map,
3+
collections::{Deduplicate, Map},
44
fold::Fold,
55
grammar::{
66
AliasTy, AtomicRelation, Binder, InferenceVar, Parameter, PlaceholderVar, RigidTy, Ty,

crates/formality-types/src/collections.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ pub trait SetExt<T>: Sized {
6767
}
6868

6969
impl<T: Ord + Clone> SetExt<T> for Set<T> {
70-
fn split_first(mut self) -> Option<(T, Set<T>)> {
71-
if let Some(e) = self.pop_first() {
72-
Some((e, self))
70+
fn split_first(self) -> Option<(T, Set<T>)> {
71+
let mut iter = self.into_iter();
72+
if let Some(e) = iter.next() {
73+
Some((e, iter.collect()))
7374
} else {
7475
None
7576
}
@@ -166,7 +167,7 @@ where
166167
}
167168
}
168169

169-
trait Deduplicate {
170+
pub trait Deduplicate {
170171
fn deduplicate(self) -> Self;
171172
}
172173

@@ -175,7 +176,7 @@ where
175176
T: Ord + Clone,
176177
{
177178
/// Remove duplicates of `v`
178-
fn deduplicate<T: Ord + Clone>(mut self: Vec<T>) -> Vec<T> {
179+
fn deduplicate(mut self) -> Vec<T> {
179180
let mut s = Set::default();
180181
self.retain(|e| s.insert(e.clone()));
181182
self

0 commit comments

Comments
 (0)