From dfd815ed83a8c5997b49eafaade83fd2eabc7dcd Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Thu, 23 May 2024 12:45:36 -0700 Subject: [PATCH 1/2] chore: Remove unused base16 dependency Noticed this dependency was unused. The `encode_base16` function was a bit useless too, as you can do this with `format!()`, not requiring a third party dependency. Parsing base16 could make sense for this as a dependency, but we're not doing that. --- crates/turbo-tasks-hash/src/base16.rs | 4 ---- crates/turbo-tasks-hash/src/lib.rs | 2 -- deny.toml | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 crates/turbo-tasks-hash/src/base16.rs 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/lib.rs b/crates/turbo-tasks-hash/src/lib.rs index 628c5c9f4175d..748628d77d640 100644 --- a/crates/turbo-tasks-hash/src/lib.rs +++ b/crates/turbo-tasks-hash/src/lib.rs @@ -4,14 +4,12 @@ //! 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}, md4::hash_md4, diff --git a/deny.toml b/deny.toml index 843310ef05035..38254c7f494cb 100644 --- a/deny.toml +++ b/deny.toml @@ -17,7 +17,7 @@ allow = [ "MPL-2.0-no-copyleft-exception", # enum-iterator* "0BSD", - # base16, notify + # notify "CC0-1.0", # Inflector, hyper-tungstenite "BSD-2-Clause", From 017a9b7ea2f114cdae85616aa7335940eb2d5fab Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Thu, 23 May 2024 13:30:27 -0700 Subject: [PATCH 2/2] Also remove dead `encode_hex_string` function and remove entries from Cargo.toml --- Cargo.lock | 8 -------- crates/turbo-tasks-hash/Cargo.toml | 2 -- crates/turbo-tasks-hash/src/hex.rs | 5 ----- crates/turbo-tasks-hash/src/lib.rs | 2 +- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ddd81ee0b35f..f18f929693a06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -645,12 +645,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a17bd29f7c70f32e9387f4d4acfa5ea7b7749ef784fb78cf382df97069337b8c" -[[package]] -name = "base16" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27c3610c36aee21ce8ac510e6224498de4228ad772a171ed65643a24693a5a8" - [[package]] name = "base64" version = "0.13.1" @@ -10166,8 +10160,6 @@ dependencies = [ name = "turbo-tasks-hash" version = "0.1.0" dependencies = [ - "base16", - "hex", "md4", "turbo-tasks-macros", "twox-hash", 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/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 748628d77d640..d6ab4c13e44f8 100644 --- a/crates/turbo-tasks-hash/src/lib.rs +++ b/crates/turbo-tasks-hash/src/lib.rs @@ -11,7 +11,7 @@ mod xxh3_hash64; pub use crate::{ deterministic_hash::{DeterministicHash, DeterministicHasher}, - hex::{encode_hex, encode_hex_string}, + hex::encode_hex, md4::hash_md4, xxh3_hash64::{hash_xxh3_hash64, Xxh3Hash64Hasher}, };