Skip to content

Commit

Permalink
ci: Use cargo-machete to check for unused dependencies (#1974)
Browse files Browse the repository at this point in the history
* ci: Use cargo-machete to check for unused dependencies

And remove the ones it found.

* --with-metadata has false positives

* Remove --no-fallback

---------

Signed-off-by: Lars Eggert <lars@eggert.org>
  • Loading branch information
larseggert authored Jul 12, 2024
1 parent 59dc0ab commit 80c7969
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ runs:
- name: Install Rust tools
shell: bash
run: |
cargo +${{ inputs.version }} quickinstall --no-binstall --no-fallback \
cargo-llvm-cov cargo-nextest flamegraph cargo-hack cargo-mutants hyperfine cargo-fuzz
cargo +${{ inputs.version }} quickinstall --no-binstall \
cargo-llvm-cov cargo-nextest flamegraph cargo-hack cargo-mutants hyperfine \
cargo-machete cargo-fuzz
# sccache slows CI down, so we leave it disabled.
# Leaving the steps below commented out, so we can re-evaluate enabling it later.
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ jobs:
cargo +${{ matrix.rust-toolchain }} fmt --all -- --check $CONFIG_PATH
if: success() || failure()

- name: Check for unused dependencies
run: |
# --with-metadata has false positives, see https://github.com/bnjbvr/cargo-machete/issues/127
cargo +${{ matrix.rust-toolchain }} machete
- name: Clippy
run: |
# Use cargo-hack to run clippy on each crate individually with its
Expand Down
2 changes: 0 additions & 2 deletions neqo-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ log = { workspace = true }
neqo-common = { path = "./../neqo-common" }
neqo-crypto = { path = "./../neqo-crypto" }
neqo-http3 = { path = "./../neqo-http3" }
neqo-qpack = { path = "./../neqo-qpack" }
neqo-transport = { path = "./../neqo-transport" }
neqo-udp = { path = "./../neqo-udp", default-features = false, features = ["tokio"] }
qlog = { workspace = true }
quinn-udp = { version = "0.5.0", default-features = false }
regex = { version = "1.9", default-features = false, features = ["unicode-perl"] }
tokio = { version = "1", default-features = false, features = ["net", "time", "macros", "rt", "rt-multi-thread"] }
url = { version = "2.5", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion neqo-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ qlog = { workspace = true }
time = { version = "0.3", default-features = false, features = ["formatting"] }

[dev-dependencies]
criterion = { version = "0.5", default-features = false, features = ["html_reports"] }
test-fixture = { path = "../test-fixture" }

[features]
Expand Down
1 change: 0 additions & 1 deletion neqo-http3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ neqo-qpack = { path = "./../neqo-qpack" }
neqo-transport = { path = "./../neqo-transport" }
qlog = { workspace = true }
sfv = { version = "0.9", default-features = false }
smallvec = { version = "1.11", default-features = false }
url = { version = "2.5", default-features = false }

[dev-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion neqo-qpack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ workspace = true
# Sync with https://searchfox.org/mozilla-central/source/Cargo.lock 2024-02-08
log = { workspace = true }
neqo-common = { path = "./../neqo-common" }
neqo-crypto = { path = "./../neqo-crypto" }
neqo-transport = { path = "./../neqo-transport" }
qlog = { workspace = true }
static_assertions = { version = "1.1", default-features = false }

[dev-dependencies]
test-fixture = { path = "../test-fixture" }

[package.metadata.cargo-machete]
ignored = ["log"]

[lib]
# See https://github.com/bheisler/criterion.rs/blob/master/book/src/faq.md#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false
3 changes: 3 additions & 0 deletions neqo-udp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ tokio = { version = "1", default-features = false, features = ["net"], optional
[dev-dependencies]
tokio = { version = "1", default-features = false, features = ["net", "time", "macros", "rt", "rt-multi-thread"] }

[package.metadata.cargo-machete]
ignored = ["log"]

[lib]
# See https://github.com/bheisler/criterion.rs/blob/master/book/src/faq.md#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false
4 changes: 3 additions & 1 deletion test-fixture/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ log = { workspace = true }
neqo-common = { path = "../neqo-common" }
neqo-crypto = { path = "../neqo-crypto" }
neqo-http3 = { path = "../neqo-http3" }
neqo-qpack = { path = "../neqo-qpack" }
neqo-transport = { path = "../neqo-transport" }
qlog = { workspace = true }

[features]
bench = []
disable-random = []

[package.metadata.cargo-machete]
ignored = ["log"]

[lib]
# See https://github.com/bheisler/criterion.rs/blob/master/book/src/faq.md#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false

0 comments on commit 80c7969

Please sign in to comment.