From 8d3c68a1deb28dce2b80ed61f85141180ce6a951 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 24 Nov 2022 17:39:08 +0100 Subject: Protect Vm --- src/model/array.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/model/array.rs') diff --git a/src/model/array.rs b/src/model/array.rs index 40b063e2..5a2f8672 100644 --- a/src/model/array.rs +++ b/src/model/array.rs @@ -128,7 +128,7 @@ impl Array { } /// Return the first matching element. - pub fn find(&self, vm: &mut Vm, f: Spanned) -> SourceResult> { + pub fn find(&self, vm: &Vm, f: Spanned) -> SourceResult> { for item in self.iter() { let args = Args::new(f.span, [item.clone()]); if f.v.call(vm, args)?.cast::().at(f.span)? { @@ -140,7 +140,7 @@ impl Array { } /// Return the index of the first matching element. - pub fn position(&self, vm: &mut Vm, f: Spanned) -> SourceResult> { + pub fn position(&self, vm: &Vm, f: Spanned) -> SourceResult> { for (i, item) in self.iter().enumerate() { let args = Args::new(f.span, [item.clone()]); if f.v.call(vm, args)?.cast::().at(f.span)? { @@ -153,7 +153,7 @@ impl Array { /// Return a new array with only those elements for which the function /// returns true. - pub fn filter(&self, vm: &mut Vm, f: Spanned) -> SourceResult { + pub fn filter(&self, vm: &Vm, f: Spanned) -> SourceResult { let mut kept = vec![]; for item in self.iter() { let args = Args::new(f.span, [item.clone()]); @@ -165,7 +165,7 @@ impl Array { } /// Transform each item in the array with a function. - pub fn map(&self, vm: &mut Vm, f: Spanned) -> SourceResult { + pub fn map(&self, vm: &Vm, f: Spanned) -> SourceResult { let enumerate = f.v.argc() == Some(2); self.iter() .enumerate() @@ -181,7 +181,7 @@ impl Array { } /// Whether any element matches. - pub fn any(&self, vm: &mut Vm, f: Spanned) -> SourceResult { + pub fn any(&self, vm: &Vm, f: Spanned) -> SourceResult { for item in self.iter() { let args = Args::new(f.span, [item.clone()]); if f.v.call(vm, args)?.cast::().at(f.span)? { @@ -193,7 +193,7 @@ impl Array { } /// Whether all elements match. - pub fn all(&self, vm: &mut Vm, f: Spanned) -> SourceResult { + pub fn all(&self, vm: &Vm, f: Spanned) -> SourceResult { for item in self.iter() { let args = Args::new(f.span, [item.clone()]); if !f.v.call(vm, args)?.cast::().at(f.span)? { -- cgit v1.2.3