diff --git a/Cargo.lock b/Cargo.lock index 62df3a1332..db3ff5619e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,7 +117,6 @@ dependencies = [ "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -149,11 +148,6 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "smallvec" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "typenum" version = "1.10.0" @@ -212,7 +206,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2eb3fe454976eefb479f78f9b394d34d661b647c6326a3a6e66f68bb12c26" -"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/Cargo.toml b/Cargo.toml index 24bcf3c518..0a4232714b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ log = "0.4" petgraph = { version = "0.4.5", optional = true } combine = "3.8.1" im-rc = "13.0.0" -smallvec = "0.6.9" [dev-dependencies] pretty_assertions = "0.5.1" diff --git a/src/eval.rs b/src/eval.rs index b9a4d1d347..145e58599f 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -4,7 +4,6 @@ use expr::Operator::*; use std::rc::Rc; use std::fmt; use im_rc::hashmap::HashMap; -use smallvec::SmallVec; use self::Evaluated::*; use self::Problem::*; @@ -21,7 +20,7 @@ pub enum Evaluated { Str(String), InterpolatedStr(Vec<(String, Ident)>, String), Char(char), - Closure(SmallVec<[Pattern; 2]>, Box, Scope), + Closure(Vec, Box, Scope), // Sum Types ApplyVariant(String, Option>), @@ -198,7 +197,7 @@ fn eval_apply(evaluated: Evaluated, args: Vec, vars: &Scope) -> Evaluated } #[inline(always)] -fn eval_closure(args: Vec, arg_patterns: SmallVec<[Pattern; 2]>, vars: &Scope) +fn eval_closure(args: Vec, arg_patterns: Vec, vars: &Scope) -> Result { if arg_patterns.len() == args.len() { @@ -313,7 +312,7 @@ fn eval_operator(left_expr: &Evaluated, op: Operator, right_expr: &Evaluated) -> } #[inline(always)] -fn eval_case (evaluated: Evaluated, branches: SmallVec<[(Pattern, Box); 2]>, vars: &Scope) -> Evaluated { +fn eval_case (evaluated: Evaluated, branches: Vec<(Pattern, Box)>, vars: &Scope) -> Evaluated { for (pattern, definition) in branches { let mut branch_vars = vars.clone(); diff --git a/src/expr.rs b/src/expr.rs index df1ac67b15..057f4a8722 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1,5 +1,3 @@ -use smallvec::SmallVec; - #[derive(Clone, Debug, PartialEq)] pub enum Expr { // Literals @@ -17,7 +15,7 @@ pub enum Expr { CallByName(Ident, Vec), Apply(Box, Vec), Operator(Box, Operator, Box), - Closure(SmallVec<[Pattern; 2]>, Box), + Closure(Vec, Box), // Sum Types ApplyVariant(String, Option>), @@ -27,7 +25,7 @@ pub enum Expr { // Conditionals If(Box, Box, Box), - Case(Box, SmallVec<[(Pattern, Box); 2]>), + Case(Box, Vec<(Pattern, Box)>), } pub type Ident = String; diff --git a/src/lib.rs b/src/lib.rs index 97fbe0d44f..6ef7923b81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,5 +12,4 @@ extern crate dogged; extern crate im_rc; -extern crate smallvec; #[macro_use] extern crate combine; diff --git a/src/parse.rs b/src/parse.rs index 8d9e036be5..058336cfe1 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -3,7 +3,6 @@ use expr::{Expr, Pattern, Ident}; use std::char; use parse_state::{IndentablePosition}; -use smallvec::SmallVec; use combine::parser::char::{char, string, spaces, digit, hex_digit, HexDigit, alpha_num}; use combine::parser::repeat::{many, count_min_max, sep_by1, skip_many, skip_many1}; @@ -218,7 +217,7 @@ where I: Stream, attempt(string("case").skip(indented_whitespaces1(min_indent))) .with(expr_body(min_indent)) .and( - many::, _>( + many::, _>( attempt( skip_many(indented_whitespaces1(min_indent)) .with(string("when").skip(indented_whitespaces1(min_indent))) diff --git a/tests/test_parse.rs b/tests/test_parse.rs index 5e98311f0e..fab50daaf2 100644 --- a/tests/test_parse.rs +++ b/tests/test_parse.rs @@ -1,5 +1,4 @@ #[macro_use] extern crate pretty_assertions; -#[macro_use] extern crate smallvec; extern crate combine; extern crate roc; @@ -567,7 +566,7 @@ mod test_parse { Ok(( Case( Box::new(Int(1)), - smallvec![( Identifier("x".to_string()), Box::new(Int(2)) )] + vec![( Identifier("x".to_string()), Box::new(Int(2)) )] ), "" )) @@ -581,7 +580,7 @@ mod test_parse { Ok(( Case( Box::new(Int(1)), - smallvec![ + vec![ ( Identifier("x".to_string()), Box::new(Int(2)) ), ( Identifier("y".to_string()), Box::new(Int(3)) ) ] @@ -598,7 +597,7 @@ mod test_parse { Ok(( Case( Box::new(Var("a".to_string())), - smallvec![ + vec![ ( Identifier("b".to_string()), Box::new(Int(1)) ), ( Identifier("c".to_string()), Box::new(Int(2)) ), ] @@ -617,7 +616,7 @@ mod test_parse { Identifier("a".to_string()), Box::new(Case( Box::new(Var("x".to_string())), - smallvec![ + vec![ ( Identifier("b".to_string()), Box::new(Int(1)) ), ( Identifier("c".to_string()), Box::new(Int(2)) ), ] @@ -636,7 +635,7 @@ mod test_parse { Ok(( Case( Box::new(Var("a".to_string())), - smallvec![ + vec![ ( Identifier("b".to_string()), Box::new(Int(1)) ), ] ), @@ -652,7 +651,7 @@ mod test_parse { Ok(( Case( Box::new(Int(1)), - smallvec![ + vec![ ( Integer(2), Box::new(Int(3)) ), ] ), @@ -668,7 +667,7 @@ mod test_parse { Ok(( Case( Box::new(Int(1)), - smallvec![ + vec![ ( Variant("Foo".to_string(), None), Box::new(Int(3)) ), ] ), @@ -684,7 +683,7 @@ mod test_parse { Ok(( Case( Box::new(Int(1)), - smallvec![ + vec![ ( Variant("Foo".to_string(), Some(vec![Identifier("x".to_string())])), Box::new(Int(3)) ), ] ), @@ -700,7 +699,7 @@ mod test_parse { Ok(( Case( Box::new(Int(0)), - smallvec![ + vec![ ( Integer(2), Box::new(CallByName("foo".to_string(), vec![Int(9)])) ), ( Integer(1), Box::new(CallByName("bar".to_string(), vec![Int(8)])) ), ] @@ -1107,7 +1106,7 @@ mod test_parse { Assign( Identifier("f".to_string()), Box::new(Closure( - smallvec![Identifier("x".to_string())], + vec![Identifier("x".to_string())], Box::new(CallByName("c".to_string(), vec![Int(1)])) )), Box::new(Var("f".to_string()))