Reverse a clone of [u8; 32] instead of allocating

This commit is contained in:
Jack Grigg 2019-03-07 23:43:58 +00:00
parent 4289843852
commit b856d23069
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ pub struct BlockHash(pub [u8; 32]);
impl fmt::Display for BlockHash {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let mut data = self.0.to_vec();
let mut data = self.0.clone();
data.reverse();
formatter.write_str(&hex::encode(data))
}

View File

@ -28,7 +28,7 @@ pub struct TxId(pub [u8; 32]);
impl fmt::Display for TxId {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let mut data = self.0.to_vec();
let mut data = self.0.clone();
data.reverse();
formatter.write_str(&hex::encode(data))
}