Skip to content

Commit

Permalink
chore: Add cargo-machete to detect unused dependencies (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored Feb 8, 2023
1 parent 2e3e9ac commit b3567a3
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ jobs:
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-hack
- name: Install cargo-machete
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-machete
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: Check fmt
run: cargo fmt -- --check
- name: Check unused dependencies
run: cargo machete
- name: Check features
run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
- name: Check all targets
Expand Down
3 changes: 3 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,6 @@ tower-http = { version = "0.3", optional = true }

[build-dependencies]
tonic-build = { path = "../tonic-build", features = ["prost"] }

[package.metadata.cargo-machete]
ignored = ["prost-types"]
3 changes: 3 additions & 0 deletions interop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ tracing-subscriber = {version = "0.3", features = ["env-filter"]}

[build-dependencies]
tonic-build = {path = "../tonic-build", features = ["prost"]}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/ambiguous_methods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/compression/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ tower-http = {version = "0.3", features = ["map-response-body", "map-request-bod

[build-dependencies]
tonic-build = {path = "../../tonic-build" }

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/disable_comments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ tonic = { path = "../../tonic" }
[build-dependencies]
prost-build = "0.11.6"
tonic-build = { path = "../../tonic-build" }

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/extern_path/my_application/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ uuid = {package = "uuid1", path = "../uuid"}

[build-dependencies]
tonic-build = {path = "../../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/extern_path/uuid/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ version = "0.1.0"
prost = "0.11"
[build-dependencies]
prost-build = "0.11.6"

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/included_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ tracing-subscriber = {version = "0.3", features = ["env-filter"]}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/same_name/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/service_named_result/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/service_named_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/stream_conflict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ tonic = { path = "../../tonic" }

[build-dependencies]
tonic-build = { path = "../../tonic-build" }

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/wellknown-compiled/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ tonic = {path = "../../tonic"}
[build-dependencies]
prost-build = "0.11.6"
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost"]
3 changes: 3 additions & 0 deletions tests/wellknown/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ tonic = {path = "../../tonic"}

[build-dependencies]
tonic-build = {path = "../../tonic-build"}

[package.metadata.cargo-machete]
ignored = ["prost", "prost-types"]

0 comments on commit b3567a3

Please sign in to comment.