From 2c0b29efd13aaacab98a9024ae8eefb8b89a528f Mon Sep 17 00:00:00 2001 From: Folkert Date: Sun, 17 Apr 2022 20:43:45 +0200 Subject: [PATCH] use VecSet in IntroducedVariables --- compiler/collections/src/all.rs | 10 +++++----- compiler/load_internal/src/file.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/collections/src/all.rs b/compiler/collections/src/all.rs index f773f0e48a..6c1a2b78c4 100644 --- a/compiler/collections/src/all.rs +++ b/compiler/collections/src/all.rs @@ -285,19 +285,19 @@ impl VecSet { impl Extend for VecSet { fn extend>(&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(); diff --git a/compiler/load_internal/src/file.rs b/compiler/load_internal/src/file.rs index 902fba613c..3eabe6bb65 100644 --- a/compiler/load_internal/src/file.rs +++ b/compiler/load_internal/src/file.rs @@ -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;