Fix existing syntactics nits.

This commit is contained in:
Josh Matthews 2015-08-13 19:06:47 -04:00
parent 7f935f010b
commit 8bb853f643
93 changed files with 393 additions and 397 deletions

View file

@ -10,7 +10,7 @@ use std::ops;
/// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in
/// performance-critical code, so a closure is insufficient.
pub trait Comparator<K,T> {
pub trait Comparator<K, T> {
fn compare(&self, key: &K, value: &T) -> Ordering;
}
@ -20,7 +20,7 @@ pub trait BinarySearchMethods<T: Ord + PartialOrd + PartialEq> {
}
pub trait FullBinarySearchMethods<T> {
fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<usize>;
fn binary_search_index_by<K, C: Comparator<K, T>>(&self, key: &K, cmp: C) -> Option<usize>;
}
impl<T: Ord + PartialOrd + PartialEq> BinarySearchMethods<T> for [T] {
@ -34,7 +34,7 @@ impl<T: Ord + PartialOrd + PartialEq> BinarySearchMethods<T> for [T] {
}
impl<T> FullBinarySearchMethods<T> for [T] {
fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<usize> {
fn binary_search_index_by<K, C: Comparator<K, T>>(&self, key: &K, cmp: C) -> Option<usize> {
if self.is_empty() {
return None;
}
@ -59,7 +59,7 @@ impl<T> FullBinarySearchMethods<T> for [T] {
struct DefaultComparator;
impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator {
impl<T: PartialEq + PartialOrd + Ord> Comparator<T, T> for DefaultComparator {
fn compare(&self, key: &T, value: &T) -> Ordering {
(*key).cmp(value)
}