fix: 优化警告代码

This commit is contained in:
shiro.lee
2024-08-06 09:31:48 +08:00
parent 669808069d
commit 7dacc47f16
9 changed files with 53 additions and 73 deletions
+2 -2
View File
@@ -10,13 +10,13 @@ pub fn hex(data: impl AsRef<[u8]>) -> String {
hex_simd::encode_to_string(data, hex_simd::AsciiCase::Lower)
}
#[cfg(not(all(feature = "openssl", not(windows))))]
#[cfg(windows)]
pub fn sha256(data: &[u8]) -> impl AsRef<[u8; 32]> {
use sha2::{Digest, Sha256};
<Sha256 as Digest>::digest(data)
}
#[cfg(all(feature = "openssl", not(windows)))]
#[cfg(not(windows))]
pub fn sha256(data: &[u8]) -> impl AsRef<[u8]> {
use openssl::hash::{Hasher, MessageDigest};
let mut h = Hasher::new(MessageDigest::sha256()).unwrap();
+1
View File
@@ -18,6 +18,7 @@ pub fn encode_dir_object(object: &str) -> String {
}
}
#[allow(dead_code)]
pub fn decode_dir_object(object: &str) -> String {
if has_suffix(object, GLOBAL_DIR_SUFFIX) {
format!("{}{}", object.trim_end_matches(GLOBAL_DIR_SUFFIX), SLASH_SEPARATOR)