Skip to content

Commit

Permalink
Fix #45
Browse files Browse the repository at this point in the history
  • Loading branch information
fizyk20 committed Sep 3, 2017
1 parent 6c24151 commit 63dddda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/impls.rs
Expand Up @@ -52,15 +52,15 @@ impl<T: PartialOrd, N> PartialOrd for GenericArray<T, N>
where N: ArrayLength<T>
{
fn partial_cmp(&self, other: &GenericArray<T, N>) -> Option<Ordering> {
PartialOrd::partial_cmp(&self, &other)
PartialOrd::partial_cmp(self.as_slice(), other.as_slice())
}
}

impl<T: Ord, N> Ord for GenericArray<T, N>
where N: ArrayLength<T>
{
fn cmp(&self, other: &GenericArray<T, N>) -> Ordering {
Ord::cmp(&self, &other)
Ord::cmp(self.as_slice(), other.as_slice())
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/mod.rs
Expand Up @@ -112,6 +112,12 @@ fn test_empty_macro() {
let arr = arr![f32;];
}

#[test]
fn test_cmp() {
use core::cmp::Ordering;
assert_eq!(arr![u8; 0x00].cmp(&arr![u8; 0x00]), Ordering::Equal);
}

/// This test should cause a helpful compile error if uncommented.
// #[test]
// fn test_empty_macro2(){
Expand Down

0 comments on commit 63dddda

Please sign in to comment.