mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 21:01:10 +00:00
Change Set::insert
type
This commit is contained in:
parent
2606638253
commit
2fdc881a2e
2 changed files with 7 additions and 2 deletions
|
@ -118,3 +118,8 @@ where
|
|||
}
|
||||
Ok(v)
|
||||
}
|
||||
|
||||
pub fn unique_in_place<T: Eq + std::hash::Hash + Clone>(v: &mut Vec<T>) {
|
||||
let mut uniques = Set::new();
|
||||
v.retain(|e| uniques.insert(e.clone()));
|
||||
}
|
||||
|
|
|
@ -141,8 +141,8 @@ impl<T: Hash + Eq> Set<T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn insert(&mut self, value: T) {
|
||||
self.elems.insert(value);
|
||||
pub fn insert(&mut self, value: T) -> bool {
|
||||
self.elems.insert(value)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue