mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Use std::cmp::Ordering explicitly.
This commit is contained in:
parent
59bca2962c
commit
524966e3af
7 changed files with 44 additions and 38 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue