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).