From 305db5014ceaeb1e62e92eba9a922e9d29afe04a Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 26 Sep 2024 09:56:22 +0200 Subject: [PATCH 1/5] Add a `cargo machete` CI step --- .github/workflows/cargo_machete.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/cargo_machete.yml diff --git a/.github/workflows/cargo_machete.yml b/.github/workflows/cargo_machete.yml new file mode 100644 index 00000000000..dab6725553c --- /dev/null +++ b/.github/workflows/cargo_machete.yml @@ -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 From 032af89ae2becca2b9fee80632dabf68d28546d2 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 26 Sep 2024 09:59:22 +0200 Subject: [PATCH 2/5] Remove some unused dependencies --- Cargo.lock | 2 -- crates/egui-winit/Cargo.toml | 1 - crates/egui_demo_lib/Cargo.toml | 1 - 3 files changed, 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a2423eaa8a..2c509d7462b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1261,7 +1261,6 @@ dependencies = [ "document-features", "egui", "log", - "nix", "puffin", "raw-window-handle 0.6.2", "serde", @@ -1306,7 +1305,6 @@ dependencies = [ "document-features", "egui", "egui_extras", - "log", "serde", "unicode_names2", ] diff --git a/crates/egui-winit/Cargo.toml b/crates/egui-winit/Cargo.toml index 4472c70f552..f8a11ec7a36 100644 --- a/crates/egui-winit/Cargo.toml +++ b/crates/egui-winit/Cargo.toml @@ -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 } diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index cc41e923abe..28b0592c228 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -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 From 94c89f5f73505d2b15853940db704c522cb71d36 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 26 Sep 2024 09:59:37 +0200 Subject: [PATCH 3/5] Ignore some false positives in cargo machete --- examples/custom_style/Cargo.toml | 5 +++++ examples/hello_world_par/Cargo.toml | 4 ++++ tests/test_egui_extras_compilation/Cargo.toml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/examples/custom_style/Cargo.toml b/examples/custom_style/Cargo.toml index 23f8a4e93c8..c7ae125493a 100644 --- a/examples/custom_style/Cargo.toml +++ b/examples/custom_style/Cargo.toml @@ -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", diff --git a/examples/hello_world_par/Cargo.toml b/examples/hello_world_par/Cargo.toml index a64e7c0e9b0..458847eba4f 100644 --- a/examples/hello_world_par/Cargo.toml +++ b/examples/hello_world_par/Cargo.toml @@ -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 diff --git a/tests/test_egui_extras_compilation/Cargo.toml b/tests/test_egui_extras_compilation/Cargo.toml index 167a8fa288c..aa1ea2c7ec9 100644 --- a/tests/test_egui_extras_compilation/Cargo.toml +++ b/tests/test_egui_extras_compilation/Cargo.toml @@ -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"] } From 7d9f6276fe6d382587a2d6e1cb80c20970cbadae Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 26 Sep 2024 10:03:48 +0200 Subject: [PATCH 4/5] Ignore another false positive --- examples/images/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/images/Cargo.toml b/examples/images/Cargo.toml index 57d552e3be4..fd6ed440b39 100644 --- a/examples/images/Cargo.toml +++ b/examples/images/Cargo.toml @@ -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", From 10307655af38940fc0524e9d4628993496225753 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 26 Sep 2024 10:07:09 +0200 Subject: [PATCH 5/5] Remove `cargo machete` step from RELEASES.md --- RELEASES.md | 1 - 1 file changed, 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index b825eef8df5..99aec8ef382 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -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