Take self directly in into_* functions

This commit is contained in:
Jack Grigg 2019-08-02 12:03:38 +01:00
parent 614d784b29
commit 1775843724
2 changed files with 7 additions and 5 deletions

View File

@ -404,7 +404,7 @@ pub fn blake2s<E: Engine, CS: ConstraintSystem<E>>(
)?;
}
Ok(h.iter().flat_map(|b| b.into_bits()).collect())
Ok(h.into_iter().flat_map(|b| b.into_bits()).collect())
}
#[cfg(test)]

View File

@ -72,8 +72,10 @@ impl UInt32 {
Ok(UInt32 { bits, value })
}
pub fn into_bits_be(&self) -> Vec<Boolean> {
self.bits.iter().rev().cloned().collect()
pub fn into_bits_be(self) -> Vec<Boolean> {
let mut ret = self.bits;
ret.reverse();
ret
}
pub fn from_bits_be(bits: &[Boolean]) -> Self {
@ -101,8 +103,8 @@ impl UInt32 {
}
/// Turns this `UInt32` into its little-endian byte order representation.
pub fn into_bits(&self) -> Vec<Boolean> {
self.bits.clone()
pub fn into_bits(self) -> Vec<Boolean> {
self.bits
}
/// Converts a little-endian byte order representation of bits into a