about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-26 09:44:30 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-26 16:49:36 -0800
commit34b98b306ad23ab895f701de1d009ff026a1d2b1 (patch)
tree444a666722fa16d289f0ef1fa9f5f13e2205baed /src/libcore
parent60299d75e2ad7e4de6482bfc50f7b5f471c1f55c (diff)
parent36372b929e9d44c7421827b160505854ceeb9a83 (diff)
downloadrust-34b98b306ad23ab895f701de1d009ff026a1d2b1.tar.gz
rust-34b98b306ad23ab895f701de1d009ff026a1d2b1.zip
rollup merge of #19287: alexcrichton/issue-19272
At the same time remove the `pub use` of the variants in favor of accessing
through the enum type itself. This is a breaking change as the `Found` and
`NotFound` variants must now be imported through `BinarySearchResult` instead of
just `std::slice`.

[breaking-change]
Closes #19271
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/slice.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 36464e4d29e..35fbde5838c 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -34,8 +34,6 @@
 // * The `raw` and `bytes` submodules.
 // * Boilerplate trait implementations.
 
-pub use self::BinarySearchResult::*;
-
 use mem::transmute;
 use clone::Clone;
 use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Less, Equal, Greater, Equiv};
@@ -219,7 +217,7 @@ pub trait SlicePrelude<T> for Sized? {
     /// found; the fourth could match any position in `[1,4]`.
     ///
     /// ```rust
-    /// use std::slice::{Found, NotFound};
+    /// use std::slice::BinarySearchResult::{Found, NotFound};
     /// let s = [0i, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     /// let s = s.as_slice();
     ///
@@ -548,7 +546,7 @@ impl<T> SlicePrelude<T> for [T] {
         while lim != 0 {
             let ix = base + (lim >> 1);
             match f(&self[ix]) {
-                Equal => return Found(ix),
+                Equal => return BinarySearchResult::Found(ix),
                 Less => {
                     base = ix + 1;
                     lim -= 1;
@@ -557,7 +555,7 @@ impl<T> SlicePrelude<T> for [T] {
             }
             lim >>= 1;
         }
-        return NotFound(base);
+        return BinarySearchResult::NotFound(base);
     }
 
     #[inline]
@@ -838,7 +836,7 @@ pub trait OrdSlicePrelude<T: Ord> for Sized? {
     /// found; the fourth could match any position in `[1,4]`.
     ///
     /// ```rust
-    /// use std::slice::{Found, NotFound};
+    /// use std::slice::BinarySearchResult::{Found, NotFound};
     /// let s = [0i, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     /// let s = s.as_slice();
     ///
@@ -1613,8 +1611,8 @@ impl BinarySearchResult {
     /// Similar to `Result::ok`.
     pub fn found(&self) -> Option<uint> {
         match *self {
-            Found(i) => Some(i),
-            NotFound(_) => None
+            BinarySearchResult::Found(i) => Some(i),
+            BinarySearchResult::NotFound(_) => None
         }
     }
 
@@ -1622,8 +1620,8 @@ impl BinarySearchResult {
     /// Similar to `Result::err`.
     pub fn not_found(&self) -> Option<uint> {
         match *self {
-            Found(_) => None,
-            NotFound(i) => Some(i)
+            BinarySearchResult::Found(_) => None,
+            BinarySearchResult::NotFound(i) => Some(i)
         }
     }
 }