little change on hash set

This commit is contained in:
Víctor Martínez 2020-12-09 00:39:07 +01:00
parent a4447d9baa
commit deaaf21949

View file

@ -43,9 +43,11 @@ impl<T: Hash + PartialEq + Clone> HashSet<T> {
match self.data[index] { match self.data[index] {
Some(ref mut list) => list.push_front(value), Some(ref mut list) => list.push_front(value),
None => { None => {
let mut list = LinkedList::new(); self.data[index] = {
list.push_back(value); let mut list = LinkedList::new();
self.data[index] = Some(list) list.push_back(value);
Some(list)
}
} }
} }
self.size += 1; self.size += 1;