From e2a362f9bbf94eedca42eceea2929e4d96f4eeee Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 5 Dec 2014 02:04:33 -0500 Subject: [PATCH] libcore: use unboxed closures in `SlicePrelude` methods --- src/libcore/slice.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index cfdb406f711..af150994765 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -238,7 +238,7 @@ pub trait SlicePrelude for Sized? { /// assert!(match r { Found(1...4) => true, _ => false, }); /// ``` #[unstable = "waiting on unboxed closures"] - fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult; + fn binary_search(&self, f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering; /// Return the number of elements in the slice /// @@ -552,7 +552,7 @@ impl SlicePrelude for [T] { } #[unstable] - fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult { + fn binary_search(&self, mut f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering { let mut base : uint = 0; let mut lim : uint = self.len();