From 1eda162867afab656ec9b95c85f725cd676d4f04 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 21 Dec 2022 23:48:04 +0100 Subject: Mutable methods with return values --- src/model/array.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/model/array.rs') diff --git a/src/model/array.rs b/src/model/array.rs index 06d1b588..02607547 100644 --- a/src/model/array.rs +++ b/src/model/array.rs @@ -93,15 +93,14 @@ impl Array { } /// Remove and return the value at the specified index. - pub fn remove(&mut self, index: i64) -> StrResult<()> { + pub fn remove(&mut self, index: i64) -> StrResult { let len = self.len(); let i = self .locate(index) .filter(|&i| i < self.0.len()) .ok_or_else(|| out_of_bounds(index, len))?; - Arc::make_mut(&mut self.0).remove(i); - Ok(()) + Ok(Arc::make_mut(&mut self.0).remove(i)) } /// Extract a contigous subregion of the array. -- cgit v1.2.3