Skip to content

Commit d0cc1c5

Browse files
authored
Introduce cargo machete to remove unused deps (quickwit-oss#6067)
* introduce cargo machete * add machete to CI * fix doc * update machete * update contributing.md * update checking machete command
1 parent ef61e13 commit d0cc1c5

File tree

15 files changed

+18
-146
lines changed

15 files changed

+18
-146
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ jobs:
145145
with:
146146
# 0.18 requires rustc 1.85
147147
tool: cargo-deny@0.17.0
148+
- name: Install cargo machete
149+
if: always() && steps.modified.outputs.rust_src == 'true'
150+
uses: taiki-e/cache-cargo-install-action@7447f04c51f2ba27ca35e7f1e28fab848c5b3ba7 # v2.3.1
151+
with:
152+
tool: cargo-machete
148153
- name: cargo clippy
149154
if: always() && steps.modified.outputs.rust_src == 'true'
150155
run: cargo clippy --workspace --tests --all-features
@@ -153,6 +158,10 @@ jobs:
153158
if: always() && steps.modified.outputs.rust_src == 'true'
154159
run: cargo deny check licenses
155160
working-directory: ./quickwit
161+
- name: cargo machete
162+
if: always() && steps.modified.outputs.rust_src == 'true'
163+
run: cargo machete
164+
working-directory: ./quickwit
156165
- name: cargo doc
157166
if: always() && steps.modified.outputs.rust_src == 'true'
158167
run: cargo doc

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Run `make test-all` to run all tests.
4848
* `make test-all` - starts necessary Docker services and runs all tests.
4949
* `make -k test-all docker-compose-down` - the same as above, but tears down the Docker services after running all the tests.
5050
* `make fmt` - runs formatter, this command requires the nightly toolchain to be installed by running `rustup toolchain install nightly`.
51-
* `make fix` - runs formatter and clippy checks.
51+
* `make fix` - runs formatter and clippy checks as well as removing unused dependencies (requires `cargo install cargo-machete`).
5252
* `make typos` - runs the spellcheck tool over the codebase. (Install by running `cargo install typos-cli`)
5353
* `make doc` - builds docs.
5454
* `make docker-compose-up` - starts Docker services.

quickwit/Cargo.lock

Lines changed: 1 addition & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ fix:
2121
@echo "Running cargo clippy --fix"
2222
@cargo clippy --workspace --all-features --tests --fix --allow-dirty --allow-staged
2323
@$(MAKE) fmt
24+
@$(MAKE) unused-deps
25+
26+
unused-deps:
27+
@echo "Checking for unused dependencies"
28+
@(command -v cargo-machete >/dev/null || cargo --list | grep -q machete || (echo "cargo-machete is not installed. Please install using 'cargo install cargo-machete'." && exit 1))
29+
@cargo machete
2430

2531
# Usage:
2632
# `make test-all` starts the Docker services and runs all the tests.

quickwit/quickwit-aws/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@ aws-sdk-kinesis = { workspace = true, optional = true }
1717
aws-sdk-s3 = { workspace = true }
1818
aws-sdk-sqs = { workspace = true, optional = true }
1919
aws-smithy-async = { workspace = true }
20-
aws-smithy-http-client = { workspace = true }
21-
aws-smithy-runtime = { workspace = true }
22-
aws-types = { workspace = true }
23-
2420
futures = { workspace = true }
25-
http-body-util = { workspace = true }
26-
hyper = { workspace = true }
27-
hyper-rustls = { workspace = true }
2821
tokio = { workspace = true }
2922

3023
quickwit-common = { workspace = true }

quickwit/quickwit-codegen/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ proc-macro2 = { workspace = true }
1818
prost-build = { workspace = true }
1919
quote = { workspace = true }
2020
syn = { workspace = true }
21-
tonic-build = { workspace = true }
2221
tonic-prost-build = { workspace = true }
2322

2423
[dev-dependencies]

quickwit/quickwit-common/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ siphasher = { workspace = true }
3939
sysinfo = { workspace = true }
4040
tempfile = { workspace = true }
4141
thiserror = { workspace = true }
42-
tikv-jemalloc-ctl = { workspace = true, optional = true }
4342
tikv-jemallocator = { workspace = true, optional = true }
4443
tokio = { workspace = true }
4544
tokio-metrics = { workspace = true }
@@ -59,7 +58,6 @@ jemalloc-profiled = [
5958
"named_tasks",
6059
"dep:backtrace",
6160
"dep:tikv-jemallocator",
62-
"dep:tikv-jemalloc-ctl",
6361
]
6462

6563
[dev-dependencies]

quickwit/quickwit-control-plane/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ rand = { workspace = true }
2424
serde = { workspace = true }
2525
serde_json = { workspace = true }
2626
smallvec = { workspace = true }
27-
time = { workspace = true }
2827
tokio = { workspace = true }
29-
tower = { workspace = true }
3028
tracing = { workspace = true }
3129
ulid = { workspace = true }
3230

quickwit/quickwit-datetime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ authors.workspace = true
1111
license.workspace = true
1212

1313
[dependencies]
14-
anyhow = { workspace = true }
1514
itertools = { workspace = true }
1615
serde = { workspace = true }
1716
serde_json = { workspace = true }

quickwit/quickwit-ingest/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ bytesize = { workspace = true }
1818
fail = { workspace = true, optional = true }
1919
futures = { workspace = true }
2020
http = { workspace = true }
21-
itertools = { workspace = true }
2221
mockall = { workspace = true, optional = true }
2322
mrecordlog = { workspace = true }
2423
once_cell = { workspace = true }

0 commit comments

Comments
 (0)