Skip to content

Commit

Permalink
Take self directly in into_* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Aug 23, 2019
1 parent 614d784 commit 1775843
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/gadgets/blake2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
10 changes: 6 additions & 4 deletions src/gadgets/uint32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1775843

Please sign in to comment.