Skip to content

refactor(deps): remove unused dependencies#32

Merged
rkuester merged 2 commits into256foundation:mainfrom
Nickamoto:remove-dead-deps
Mar 11, 2026
Merged

refactor(deps): remove unused dependencies#32
rkuester merged 2 commits into256foundation:mainfrom
Nickamoto:remove-dead-deps

Conversation

@Nickamoto
Copy link
Contributor

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.

Fix unused import warnings in tracing.rs by gating linux-only imports (env, tracing_journald, prelude) behind cfg(target_os).

Eliminates ~15 exclusive transitive crates.

Refs: #29

@jayrmotta
Copy link

tACK e8718fc

@average-gary
Copy link
Contributor

Independently arrived at the same changes via a dependency audit posted in Discussion #8. Confirmed the same 6 unused deps using both cargo-machete (source-code heuristic) and cargo +nightly udeps (compiler-level analysis):

$ cargo machete
mujina-dissect -- ./tools/mujina-dissect/Cargo.toml:
	hex
	thiserror
	tracing
mujina-miner -- ./mujina-miner/Cargo.toml:
	hyper
	modular-bitfield
	sha2

$ cargo +nightly udeps --workspace
unused dependencies:
`mujina-miner v0.1.0`
└─── dependencies
     └─── "modular-bitfield"

Nice that this PR also fixes the tracing.rs cfg gating — we noted those as pre-existing clippy failures on macOS but didn't include the fix. LGTM.

Closed my duplicate PR #35 in favor of this one.

use nix::libc;

#[cfg(target_os = "linux")]
use tracing_journald;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with this on macos?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the use tracing_journald; line is skipped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skot is right. Also updated Cargo.toml, moving tracing-journald into [target.'cfg(target_os = "linux")'.dependencies], so it won't be compiled on macOS at all rather than just skipped.

Nickamoto and others added 2 commits March 11, 2026 17:29
Remove dependencies confirmed unused by cargo-machete analysis,
as identified in the dependency audit (discussion 256foundation#8, issue 256foundation#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: 256foundation#29
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.
@rkuester
Copy link
Collaborator

Thanks for your first contribution, Nick, and welcome to the project!

I restructured the commits slightly. The original first commit mixed dep removal with cfg-gating fixes in tracing.rs. I moved the cfg-gating changes into the second commit alongside the tracing-journald platform gating.

Also changed the type from refactor to build since these are build configuration changes rather than code restructuring with no change in behavior.

@rkuester rkuester merged commit 71f78df into 256foundation:main Mar 11, 2026
1 check passed
rkuester added a commit that referenced this pull request Mar 11, 2026
PR #32 introduced per-import #[cfg] annotations to suppress macOS
warnings, and subsequent cleanup in the same area was piling up
more scattered cfg blocks. Consolidate all journald logic into a
mod journald gated once on target_os = "linux", with a no-op stub
for other platforms.

Rename init_journald_or_stdout to init since callers should not
need to know the logging strategy.
@Nickamoto Nickamoto deleted the remove-dead-deps branch March 12, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants