ecaps2: Avoid a useless clone.

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-18 23:12:45 +01:00
parent bbdf38d58b
commit f18043231c

View file

@ -120,7 +120,6 @@ pub fn compute_disco(disco: &Disco) -> Vec<u8> {
pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> { pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
Ok(Hash { Ok(Hash {
algo: algo.clone(),
hash: match algo { hash: match algo {
Algo::Sha_256 => { Algo::Sha_256 => {
let mut hasher = Sha256::default(); let mut hasher = Sha256::default();
@ -163,6 +162,7 @@ pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
Algo::Sha_1 => return Err(String::from("Disabled algorithm sha-1: unsafe.")), Algo::Sha_1 => return Err(String::from("Disabled algorithm sha-1: unsafe.")),
Algo::Unknown(algo) => return Err(format!("Unknown algorithm: {}.", algo)), Algo::Unknown(algo) => return Err(format!("Unknown algorithm: {}.", algo)),
}, },
algo: algo,
}) })
} }