diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-12-30 10:51:18 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-12-30 17:06:08 -0800 |
| commit | 6abfac083feafc73e5d736177755cce3bfb7153f (patch) | |
| tree | d5502fab0dd68ea96057616eb20d90a2c9050218 /src/libunicode/normalize.rs | |
| parent | 6e1879eaf1cb5e727eb134a3e27018f7535852eb (diff) | |
| download | rust-6abfac083feafc73e5d736177755cce3bfb7153f.tar.gz rust-6abfac083feafc73e5d736177755cce3bfb7153f.zip | |
Fallout from stabilization
Diffstat (limited to 'src/libunicode/normalize.rs')
| -rw-r--r-- | src/libunicode/normalize.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libunicode/normalize.rs b/src/libunicode/normalize.rs index d239cb82896..9e4aa071247 100644 --- a/src/libunicode/normalize.rs +++ b/src/libunicode/normalize.rs @@ -13,21 +13,21 @@ use core::cmp::Ordering::{Equal, Less, Greater}; use core::option::Option; use core::option::Option::{Some, None}; -use core::slice; use core::slice::SliceExt; +use core::result::Result::{Ok, Err}; use tables::normalization::{canonical_table, compatibility_table, composition_table}; fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'static [T]> { - match r.binary_search(|&(val, _)| { + match r.binary_search_by(|&(val, _)| { if c == val { Equal } else if val < c { Less } else { Greater } }) { - slice::BinarySearchResult::Found(idx) => { + Ok(idx) => { let (_, result) = r[idx]; Some(result) } - slice::BinarySearchResult::NotFound(_) => None + Err(_) => None } } @@ -81,16 +81,16 @@ pub fn compose(a: char, b: char) -> Option<char> { match bsearch_table(a, composition_table) { None => None, Some(candidates) => { - match candidates.binary_search(|&(val, _)| { + match candidates.binary_search_by(|&(val, _)| { if b == val { Equal } else if val < b { Less } else { Greater } }) { - slice::BinarySearchResult::Found(idx) => { + Ok(idx) => { let (_, result) = candidates[idx]; Some(result) } - slice::BinarySearchResult::NotFound(_) => None + Err(_) => None } } } |
