From c0a05bb34c06b5b30c5374efe05fc7557788b2cc Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 24 May 2024 00:41:14 -0700 Subject: [PATCH] chore: Remove unused `base16` dependency and dead `hex` wrapper function (vercel/turbo#8207) ### Description Noticed these dependencies/functions were unused. For the most part, it's better to do these conversions with the built-in `format!()`. Parsing base16 could make sense for this as a dependency, but we're not doing that. ### Testing Instructions ``` cargo check ``` Also grepped through next.js to check that we're not using it there. --- crates/turbo-tasks-hash/Cargo.toml | 2 -- crates/turbo-tasks-hash/src/base16.rs | 4 ---- crates/turbo-tasks-hash/src/hex.rs | 5 ----- crates/turbo-tasks-hash/src/lib.rs | 4 +--- 4 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 crates/turbo-tasks-hash/src/base16.rs diff --git a/crates/turbo-tasks-hash/Cargo.toml b/crates/turbo-tasks-hash/Cargo.toml index 64e20a1cd8d21..05dcad51392ff 100644 --- a/crates/turbo-tasks-hash/Cargo.toml +++ b/crates/turbo-tasks-hash/Cargo.toml @@ -13,8 +13,6 @@ bench = false workspace = true [dependencies] -base16 = "0.2.1" -hex = "0.4.3" md4 = "0.10.1" turbo-tasks-macros = { workspace = true } twox-hash = "1.6.3" diff --git a/crates/turbo-tasks-hash/src/base16.rs b/crates/turbo-tasks-hash/src/base16.rs deleted file mode 100644 index 9d4b11b4bfcd9..0000000000000 --- a/crates/turbo-tasks-hash/src/base16.rs +++ /dev/null @@ -1,4 +0,0 @@ -/// Encodes an array of bytes as a base16 string. -pub fn encode_base16(input: &[u8]) -> String { - base16::encode_lower(input) -} diff --git a/crates/turbo-tasks-hash/src/hex.rs b/crates/turbo-tasks-hash/src/hex.rs index 771412320e054..9fd35fa975f22 100644 --- a/crates/turbo-tasks-hash/src/hex.rs +++ b/crates/turbo-tasks-hash/src/hex.rs @@ -2,8 +2,3 @@ pub fn encode_hex(n: u64) -> String { format!("{:01$x}", n, std::mem::size_of::() * 2) } - -/// Encodes a byte slice into a hex string. -pub fn encode_hex_string(bytes: &[u8]) -> String { - hex::encode(bytes) -} diff --git a/crates/turbo-tasks-hash/src/lib.rs b/crates/turbo-tasks-hash/src/lib.rs index 628c5c9f4175d..d6ab4c13e44f8 100644 --- a/crates/turbo-tasks-hash/src/lib.rs +++ b/crates/turbo-tasks-hash/src/lib.rs @@ -4,16 +4,14 @@ //! invalidation, and encoding the hash to an hexadecimal string for use in a //! file name. -mod base16; mod deterministic_hash; mod hex; mod md4; mod xxh3_hash64; pub use crate::{ - base16::encode_base16, deterministic_hash::{DeterministicHash, DeterministicHasher}, - hex::{encode_hex, encode_hex_string}, + hex::encode_hex, md4::hash_md4, xxh3_hash64::{hash_xxh3_hash64, Xxh3Hash64Hasher}, };