diff --git a/src/array.rs b/src/array.rs index aa3b7ae..e5ce1cc 100644 --- a/src/array.rs +++ b/src/array.rs @@ -15,14 +15,11 @@ pub unsafe trait Array { } pub trait Index : PartialEq + Copy { - fn zero() -> Self; fn to_usize(self) -> usize; fn from(usize) -> Self; } impl Index for u8 { - #[inline(always)] - fn zero() -> Self { 0 } #[inline(always)] fn to_usize(self) -> usize { self as usize } #[inline(always)] @@ -30,8 +27,6 @@ impl Index for u8 { } impl Index for u16 { - #[inline(always)] - fn zero() -> Self { 0 } #[inline(always)] fn to_usize(self) -> usize { self as usize } #[inline(always)] diff --git a/src/lib.rs b/src/lib.rs index 73d9324..de84109 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,7 +96,7 @@ impl ArrayVec { /// ``` pub fn new() -> ArrayVec { unsafe { - ArrayVec { xs: NoDrop::new(new_array()), len: Index::zero() } + ArrayVec { xs: NoDrop::new(new_array()), len: Index::from(0) } } } @@ -440,7 +440,7 @@ impl IntoIterator for ArrayVec { type Item = A::Item; type IntoIter = IntoIter; fn into_iter(self) -> IntoIter { - IntoIter { index: Index::zero(), v: self, } + IntoIter { index: Index::from(0), v: self, } } }