From c60b548cc7bcafde39edfef71123eafbc8c9f588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Sat, 7 Oct 2023 14:40:05 +0300 Subject: [PATCH] fix(lints): apply clippy suggestions --- src/util.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util.rs b/src/util.rs index ebc02351..d404cfc7 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,7 +3,9 @@ use actix_web::{error, Error as ActixError}; use glob::glob; use lazy_regex::{lazy_regex, Lazy, Regex}; use ring::digest::{Context, SHA256}; +use std::fmt::Write; use std::io::{BufReader, Read}; +use std::io::{Error as IoError, ErrorKind as IoErrorKind, Result as IoResult}; use std::path::{Path, PathBuf}; use std::time::Duration; use std::time::{SystemTime, UNIX_EPOCH}; @@ -99,8 +101,11 @@ pub fn sha256_digest(input: R) -> Result { .iter() .collect::>() .iter() - .map(|byte| format!("{byte:02x}")) - .collect::()) + .try_fold::>(String::new(), |mut output, b| { + write!(output, "{b:02x}") + .map_err(|e| IoError::new(IoErrorKind::Other, e.to_string()))?; + Ok(output) + })?) } #[cfg(test)]