From f1c660c5b51294bf99aa169d90c29b2e0df6a77e Mon Sep 17 00:00:00 2001 From: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:57:26 +0200 Subject: [PATCH] Fix some Errors --- argon2/src/lib.rs | 11 +---------- argon2/src/params.rs | 7 ++----- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/argon2/src/lib.rs b/argon2/src/lib.rs index f5e50415..21e04abf 100644 --- a/argon2/src/lib.rs +++ b/argon2/src/lib.rs @@ -173,12 +173,6 @@ pub struct Argon2<'key> { cpu_feat_avx2: avx2_cpuid::InitToken, } -impl Default for Argon2<'_> { - fn default() -> Self { - Self::DEFAULT - } -} - impl fmt::Debug for Argon2<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Argon2") @@ -190,11 +184,8 @@ impl fmt::Debug for Argon2<'_> { } impl<'key> Argon2<'key> { - /// Default parameters (recommended). - pub const DEFAULT: Argon2<'static> = - Argon2::new(Algorithm::DEFAULT, Version::DEFAULT, Params::DEFAULT); /// Create a new Argon2 context. - pub const fn new(algorithm: Algorithm, version: Version, params: Params) -> Self { + pub fn new(algorithm: Algorithm, version: Version, params: Params) -> Self { Self { algorithm, version, diff --git a/argon2/src/params.rs b/argon2/src/params.rs index d8be2df8..98b5cec4 100644 --- a/argon2/src/params.rs +++ b/argon2/src/params.rs @@ -510,14 +510,11 @@ impl ParamsBuilder { } /// Create a new [`Argon2`] context using the provided algorithm/version. - pub const fn context(&self, algorithm: Algorithm, version: Version) -> Result> { + pub fn context(&self, algorithm: Algorithm, version: Version) -> Result> { Ok(Argon2::new( algorithm, version, - match self.build() { - Ok(params) => params, - Err(e) => return Err(e), - }, + self.build()? )) } /// Default parameters (recommended).