Use std::cmp::Ordering explicitly.

This commit is contained in:
Ms2ger 2015-01-22 13:25:07 +01:00
parent 59bca2962c
commit 524966e3af
7 changed files with 44 additions and 38 deletions

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::cmp::{PartialOrd, PartialEq};
use std::cmp::{PartialOrd, PartialEq, Ordering};
#[cfg(test)]
use std::fmt::Show;
@ -47,9 +47,9 @@ impl<'a, T> FullBinarySearchMethods<T> for &'a [T] {
let midv = &self[mid];
match cmp.compare(key, midv) {
Greater => low = (mid as int) + 1,
Less => high = (mid as int) - 1,
Equal => return Some(mid),
Ordering::Greater => low = (mid as int) + 1,
Ordering::Less => high = (mid as int) - 1,
Ordering::Equal => return Some(mid),
}
}
return None;