From 2f570fcabe2ab3eae8065366fc1965fcbff42572 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 24 Dec 2020 13:02:53 +0100 Subject: [PATCH] xmpp-parsers/caps: Simplify get_hash_vec(). --- xmpp-parsers/src/caps.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xmpp-parsers/src/caps.rs b/xmpp-parsers/src/caps.rs index 2b5e2fb0..24f129a2 100644 --- a/xmpp-parsers/src/caps.rs +++ b/xmpp-parsers/src/caps.rs @@ -158,9 +158,7 @@ pub fn compute_disco(disco: &DiscoInfoResult) -> Vec { } fn get_hash_vec(hash: &[u8]) -> Vec { - let mut vec = Vec::with_capacity(hash.len()); - vec.extend_from_slice(hash); - vec + hash.to_vec() } /// Hashes the result of [compute_disco()] with one of the supported [hash