From b3237aecb6070a369ad02db81fcae98d5c34a980 Mon Sep 17 00:00:00 2001 From: Nickamoto Date: Wed, 11 Mar 2026 16:28:34 -0500 Subject: [PATCH 1/2] build(deps): remove unused dependencies Remove dependencies confirmed unused by cargo-machete analysis, as identified in the dependency audit (discussion #8, issue #29). mujina-miner: - sha2: bitcoin crate provides SHA-256 via bitcoin_hashes - hyper (direct): still available transitively via axum/reqwest - modular-bitfield: no usage in source mujina-dissect: - hex: no usage in source - thiserror: no usage in source - tracing: no usage in source (tracing-subscriber retained) Also removes sha2, hyper, and modular-bitfield from workspace dependencies as they are no longer referenced by any member. Eliminates ~15 exclusive transitive crates. Refs: #29 --- Cargo.toml | 3 --- mujina-miner/Cargo.toml | 3 --- tools/mujina-dissect/Cargo.toml | 9 ++------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6985a7d..7ce3aef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,12 +20,9 @@ bytes = "1" crc_all = "0.2" futures = "0.3" hex = "0.4" -hyper = { version = "1", features = ["full"] } inventory = "0.3" -modular-bitfield = "0.12" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sha2 = "0.10" strum = { version = "0.27", features = ["derive"] } test-case = "3.3.1" thiserror = "2.0" diff --git a/mujina-miner/Cargo.toml b/mujina-miner/Cargo.toml index b3520e0..e69ceb8 100644 --- a/mujina-miner/Cargo.toml +++ b/mujina-miner/Cargo.toml @@ -19,12 +19,9 @@ bytes = { workspace = true } crc_all = { workspace = true } futures = { workspace = true } hex = { workspace = true } -hyper = { workspace = true } inventory = { workspace = true } -modular-bitfield = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -sha2 = { workspace = true } strum = { workspace = true } thiserror = { workspace = true } time = { workspace = true } diff --git a/tools/mujina-dissect/Cargo.toml b/tools/mujina-dissect/Cargo.toml index 58fca1d..1669142 100644 --- a/tools/mujina-dissect/Cargo.toml +++ b/tools/mujina-dissect/Cargo.toml @@ -22,7 +22,6 @@ mujina-miner = { path = "../../mujina-miner" } # CLI and utilities clap = { version = "4", features = ["derive"] } anyhow = "1.0" -thiserror = "2.0" # CSV parsing csv = "1.3" @@ -34,14 +33,10 @@ chrono = "0.4" # Output formatting colored = "2.0" -# Hex formatting -hex = "0.4" - # Protocol parsing bytes = "1.7" tokio-util = { version = "0.7", features = ["codec"] } bitcoin = { workspace = true } -# Logging (optional) -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } \ No newline at end of file +# Logging +tracing-subscriber = { version = "0.3", features = ["env-filter"] } From 60eddafeb0b64d71dab20a31cb0dddecf81f15e5 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 11 Mar 2026 16:29:23 -0500 Subject: [PATCH 2/2] build(deps): gate linux-only tracing deps to linux target Move tracing-journald from unconditional [dependencies] to [target.'cfg(target_os = "linux")'.dependencies] so it is not compiled on macOS. Gate the corresponding imports in tracing.rs (env, tracing_journald, prelude::*) behind cfg(target_os = "linux") to match, fixing unused-import warnings on macOS builds. --- mujina-miner/Cargo.toml | 2 +- mujina-miner/src/tracing.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mujina-miner/Cargo.toml b/mujina-miner/Cargo.toml index e69ceb8..043bb4f 100644 --- a/mujina-miner/Cargo.toml +++ b/mujina-miner/Cargo.toml @@ -34,7 +34,6 @@ utoipa = { workspace = true } utoipa-axum = { workspace = true } utoipa-swagger-ui = { workspace = true } tracing = { workspace = true } -tracing-journald = { workspace = true } tracing-subscriber = { workspace = true } nix = { workspace = true } parking_lot = { workspace = true } @@ -47,6 +46,7 @@ ruint = "1.17.0" [target.'cfg(target_os = "linux")'.dependencies] tokio-udev = { workspace = true } +tracing-journald = { workspace = true } udev = { workspace = true } [[bin]] diff --git a/mujina-miner/src/tracing.rs b/mujina-miner/src/tracing.rs index e22b5ee..7d69406 100644 --- a/mujina-miner/src/tracing.rs +++ b/mujina-miner/src/tracing.rs @@ -8,11 +8,10 @@ //! access to the `trace!()`, `debug!()`, `info!()`, `warn!()`, and `error!()` //! macros. -use std::{env, fmt}; +use std::fmt; use time::OffsetDateTime; use tracing::field::{Field, Visit}; use tracing::{Event, Level, Subscriber}; -use tracing_journald; use tracing_subscriber::{ filter::{EnvFilter, LevelFilter}, fmt::{ @@ -25,16 +24,20 @@ use tracing_subscriber::{ }; #[cfg(target_os = "linux")] -use std::{io, os::unix::io::AsRawFd}; +use std::{env, io, os::unix::io::AsRawFd}; #[cfg(target_os = "linux")] use nix::libc; +#[cfg(target_os = "linux")] +use tracing_journald; + pub mod prelude { #[allow(unused_imports)] pub use tracing::{debug, error, info, trace, warn}; } +#[cfg(target_os = "linux")] use prelude::*; /// Check if stderr is connected to systemd journal by validating JOURNAL_STREAM.