Remove explicit lifetimes

This commit is contained in:
Henry de Valence 2017-04-02 23:36:05 +02:00
parent c8e7e22ddf
commit 7f4b96150d
3 changed files with 14 additions and 20 deletions

View file

@ -116,7 +116,7 @@ impl Debug for CompressedEdwardsY {
impl CompressedEdwardsY {
/// View this `CompressedEdwardsY` as an array of bytes.
pub fn as_bytes<'a>(&'a self) -> &'a [u8; 32] {
pub fn as_bytes(&self) -> &[u8; 32] {
&self.0
}

View file

@ -110,16 +110,14 @@ impl Debug for FieldElement {
impl Index<usize> for FieldElement {
type Output = Limb;
fn index<'a>(&'a self, _index: usize) -> &'a Limb {
let ret: &'a Limb = &(self.0[_index]);
ret
fn index(&self, _index: usize) -> &Limb {
&(self.0[_index])
}
}
impl IndexMut<usize> for FieldElement {
fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut Limb {
let ret: &'a mut Limb = &mut(self.0[_index]);
ret
fn index_mut(&mut self, _index: usize) -> &mut Limb {
&mut(self.0[_index])
}
}

View file

@ -90,16 +90,14 @@ impl CTEq for Scalar {
impl Index<usize> for Scalar {
type Output = u8;
fn index<'a>(&'a self, _index: usize) -> &'a u8 {
let ret: &'a u8 = &(self.0[_index]);
ret
fn index(&self, _index: usize) -> &u8 {
&(self.0[_index])
}
}
impl IndexMut<usize> for Scalar {
fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut u8 {
let ret: &'a mut u8 = &mut(self.0[_index]);
ret
fn index_mut(&mut self, _index: usize) -> &mut u8 {
&mut(self.0[_index])
}
}
@ -194,7 +192,7 @@ impl Scalar {
}
/// View this `Scalar` as a sequence of bytes.
pub fn as_bytes<'a>(&'a self) -> &'a [u8;32] {
pub fn as_bytes(&self) -> &[u8;32] {
&self.0
}
@ -381,16 +379,14 @@ pub struct UnpackedScalar(pub [i64; 12]);
impl Index<usize> for UnpackedScalar {
type Output = i64;
fn index<'a>(&'a self, _index: usize) -> &'a i64 {
let ret: &'a i64 = &(self.0[_index]);
ret
fn index(&self, _index: usize) -> &i64 {
&(self.0[_index])
}
}
impl IndexMut<usize> for UnpackedScalar {
fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut i64 {
let ret: &'a mut i64 = &mut(self.0[_index]);
ret
fn index_mut(&mut self, _index: usize) -> &mut i64 {
&mut(self.0[_index])
}
}