use VecSet in IntroducedVariables

This commit is contained in:
Folkert 2022-04-17 20:43:45 +02:00
parent a1a7feca45
commit 2c0b29efd1
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 6 additions and 6 deletions

View file

@ -285,19 +285,19 @@ impl<T: PartialEq> VecSet<T> {
impl<A: Ord> Extend<A> for VecSet<A> {
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T) {
let mut it = iter.into_iter();
let it = iter.into_iter();
let hint = it.size_hint();
match hint {
(0, Some(0)) => {
// done, do nothing
}
(1, Some(1)) => {
let value = it.next().unwrap();
self.insert(value);
(1, Some(1)) | (2, Some(2)) => {
for value in it {
self.insert(value);
}
}
_ => {
println!("extend {:?}", hint);
self.elements.extend(it);
self.elements.sort();

View file

@ -41,7 +41,7 @@ use roc_types::solved_types::Solved;
use roc_types::subs::{Subs, VarStore, Variable};
use roc_types::types::{Alias, AliasCommon, TypeExtension};
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::{HashMap, };
use std::collections::HashMap;
use std::io;
use std::iter;
use std::ops::ControlFlow;