Skip to content

Commit

Permalink
Fix some Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
C0D3-M4513R committed Aug 11, 2023
1 parent 022a9ca commit f1c660c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
11 changes: 1 addition & 10 deletions argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions argon2/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Argon2<'_>> {
pub fn context(&self, algorithm: Algorithm, version: Version) -> Result<Argon2<'_>> {
Ok(Argon2::new(
algorithm,
version,
match self.build() {
Ok(params) => params,
Err(e) => return Err(e),
},
self.build()?
))
}
/// Default parameters (recommended).
Expand Down

0 comments on commit f1c660c

Please sign in to comment.