diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-06-13 23:16:40 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-06-14 13:53:02 +0200 |
| commit | c81e2a5f56eb262663f292578c683fba7f18251f (patch) | |
| tree | 6c045a8dcbec5e75e01a15f970ef8cee6ff042d0 /src/eval/array.rs | |
| parent | 891af17260a6750a74a102388a05e59cf1ffc3c1 (diff) | |
Many fixes
Diffstat (limited to 'src/eval/array.rs')
| -rw-r--r-- | src/eval/array.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/eval/array.rs b/src/eval/array.rs index fda6f390..aea1b0be 100644 --- a/src/eval/array.rs +++ b/src/eval/array.rs @@ -137,7 +137,7 @@ impl Array { } /// Return a new array with only those elements for which the function - /// return true. + /// returns true. pub fn filter(&self, vm: &mut Machine, f: Spanned<Func>) -> TypResult<Self> { let mut kept = vec![]; for item in self.iter() { @@ -154,7 +154,7 @@ impl Array { /// Return a new array with all items from this and nested arrays. pub fn flatten(&self) -> Self { - let mut flat = vec![]; + let mut flat = Vec::with_capacity(self.0.len()); for item in self.iter() { if let Value::Array(nested) = item { flat.extend(nested.flatten().into_iter()); |
