Small change

This commit is contained in:
StNicolay 2024-08-06 16:44:49 +03:00
parent 2b12996453
commit 8eb5be96b3
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
2 changed files with 5 additions and 4 deletions

View File

@ -65,7 +65,7 @@ impl HashedBytes {
/// Hashes the bytes /// Hashes the bytes
#[must_use] #[must_use]
pub fn hash_bytes(bytes: &[u8]) -> Self { pub fn hash_bytes(bytes: &[u8]) -> Self {
let mut salt = [0; 64]; let mut salt = [0; SALT_LENGTH];
OsRng.fill_bytes(&mut salt); OsRng.fill_bytes(&mut salt);
Self { Self {
hash: hash_scrypt(bytes, &salt), hash: hash_scrypt(bytes, &salt),

View File

@ -92,9 +92,10 @@ pub trait ItemNotFoundExt<T> {
impl<T> ItemNotFoundExt<T> for Option<T> { impl<T> ItemNotFoundExt<T> for Option<T> {
fn item_not_found(self) -> GeneralResult<T> { fn item_not_found(self) -> GeneralResult<T> {
const ITEM_NOT_FOUND_ERROR: GeneralError = self.ok_or(GeneralError::const_message(
GeneralError::const_message(StatusCode::NOT_FOUND, "Item not found"); StatusCode::NOT_FOUND,
self.ok_or(ITEM_NOT_FOUND_ERROR) "Item not found",
))
} }
} }