mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
fix: avoid mutating self in TagShare::add (#748)
This commit is contained in:
@@ -287,9 +287,12 @@ struct TagShare([u8; 16]);
|
||||
impl Add for TagShare {
|
||||
type Output = Vec<u8>;
|
||||
|
||||
fn add(mut self, rhs: Self) -> Self::Output {
|
||||
self.0.iter_mut().zip(rhs.0).for_each(|(a, b)| *a ^= b);
|
||||
self.0.to_vec()
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
self.0
|
||||
.iter()
|
||||
.zip(rhs.0)
|
||||
.map(|(a, b)| *a ^ b)
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ impl Task for ComputeTags {
|
||||
let tags = tag_shares
|
||||
.into_iter()
|
||||
.zip(follower_tag_shares)
|
||||
.map(|(a, b)| (a + b).to_vec())
|
||||
.map(|(a, b)| a + b)
|
||||
.collect();
|
||||
|
||||
Some(tags)
|
||||
|
||||
Reference in New Issue
Block a user