Skip to content

Commit

Permalink
Add a cargo machete CI step (#5171)
Browse files Browse the repository at this point in the history
`cargo machete` looks for unused dependencies
  • Loading branch information
emilk authored Sep 26, 2024
1 parent 92adfa5 commit a72ebbe
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/cargo_machete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Cargo Machete

on: [push, pull_request]

jobs:
cargo-machete:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
uses: bnjbvr/cargo-machete@main
2 changes: 0 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,6 @@ dependencies = [
"document-features",
"egui",
"log",
"nix",
"puffin",
"raw-window-handle 0.6.2",
"serde",
Expand Down Expand Up @@ -1306,7 +1305,6 @@ dependencies = [
"document-features",
"egui",
"egui_extras",
"log",
"serde",
"unicode_names2",
]
Expand Down
1 change: 0 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ We don't update the MSRV in a patch release, unless we really, really need to.
* [ ] `./scripts/docs.sh`: read and improve documentation of new stuff
* [ ] `cargo update`
* [ ] `cargo outdated` (or manually look for outdated crates in each `Cargo.toml`)
* [ ] `cargo machete`

## Release testing
* [ ] `cargo r -p egui_demo_app` and click around for while
Expand Down
1 change: 0 additions & 1 deletion crates/egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ egui = { workspace = true, default-features = false, features = ["log"] }

ahash.workspace = true
log.workspace = true
nix = { version = "0.26.4", default-features = false, optional = true }
raw-window-handle.workspace = true
web-time.workspace = true
winit = { workspace = true, default-features = false }
Expand Down
1 change: 0 additions & 1 deletion crates/egui_demo_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ syntect = ["egui_extras/syntect"]
egui = { workspace = true, default-features = false, features = ["color-hex"] }
egui_extras = { workspace = true, features = ["default"] }

log.workspace = true
unicode_names2 = { version = "0.6.0", default-features = false } # this old version has fewer dependencies

#! ### Optional dependencies
Expand Down
5 changes: 5 additions & 0 deletions examples/custom_style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ publish = false
[lints]
workspace = true


[package.metadata.cargo-machete]
ignored = ["image"] # We need the .png feature


[dependencies]
eframe = { workspace = true, features = [
"default",
Expand Down
4 changes: 4 additions & 0 deletions examples/hello_world_par/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ publish = false
workspace = true


[package.metadata.cargo-machete]
ignored = ["winit"] # Just enable some features of it; see below


[dependencies]
eframe = { workspace = true, default-features = false, features = [
# accesskit struggles with threading
Expand Down
4 changes: 4 additions & 0 deletions examples/images/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ publish = false
workspace = true


[package.metadata.cargo-machete]
ignored = ["image"] # We only use the dependency to add more features to it


[dependencies]
eframe = { workspace = true, features = [
"default",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_egui_extras_compilation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ publish = false
[lints]
workspace = true

[package.metadata.cargo-machete]
ignored = ["eframe", "egui_extras"] # We don't use them, just check that things compile

[dependencies]
eframe = { workspace = true, features = ["default", "persistence"] }
Expand Down

0 comments on commit a72ebbe

Please sign in to comment.