Giter VIP home page Giter VIP logo

Comments (13)

kvark avatar kvark commented on September 15, 2024 5

I finished cleaning up Zed - zed-industries/zed#8468
In a series of 4 PR, around 600 LOC were removed from Cargo.lock with many unused dependencies.
In the meantime,

And cargo-udeps shows me that All deps seem to have been used., now I'm convinced to remove it.

from cargo-machete.

dmerejkowsky avatar dmerejkowsky commented on September 15, 2024 3

https://git.sr.ht/~dmerej/skyspell/commit/722c4eeb302df160d5dc973f571516b03699e9a5

It works !

from cargo-machete.

randombit avatar randombit commented on September 15, 2024 3

A colleague used cargo machete to remove dozens of unused dependencies from our project

dfinity/ic@a3b6beb

Thank you!!

from cargo-machete.

torokati44 avatar torokati44 commented on September 15, 2024 3

I has been useful, yes: ruffle-rs/ruffle#15774 :)

from cargo-machete.

Veetaha avatar Veetaha commented on September 15, 2024 2

I applied it in a really large cargo workspace in our private repository and it detected like really many unused crates for us!
Our workspace is around 122 crates, and we managed to remove ~187 unused dependencies 🎉!

However, the number of false positives was ~67.

The main problem is that we use a lot of code included from OUT_DIR, which isn't analyzed.

Also, cargo-machete --with-metadata doesn't analyze build.rs tests and other rust files from examples/ directory (also, I am not sure but maybe benches/ directory is not analyzed either?) for some reason (is it broken?)

Also, looks like pub use ::crate_name reference doesn't seem to be picked up by cargo-machete

from cargo-machete.

Bromeon avatar Bromeon commented on September 15, 2024 2

godot-rust/gdnative#890 (revision 84c99b1)

  • 6 unneeded dependencies detected (2 of which between internal crates)
  • 1 false positive (low, since we have a lot of codegen)
  • integrated into CI (very easy now thanks to #25)

from cargo-machete.

bnjbvr avatar bnjbvr commented on September 15, 2024 2

Also, looks like pub use ::crate_name reference doesn't seem to be picked up by cargo-machete

Ah, looks like an oversight, will add a test and support for that, thanks!

from cargo-machete.

mickvangelderen avatar mickvangelderen commented on September 15, 2024 2

I've used cargo-machete alongside cargo-udeps to quickly find and remove unneeded dependencies after splitting one crate into multiple crates. I had to manually add some exceptions for dependencies of code generated through build scripts as well but other than that worked great.

from cargo-machete.

xxchan avatar xxchan commented on September 15, 2024 2

risingwavelabs/risingwave#7816 It helped a lot! Thanks for the great tool. Tens of udeps are removed.

The commit history in this PR also shows how I used it and the problems I met:

  • We are using workspace-hack (managed by cargo hakari), so I added the ignore to every Cargo.toml. It might be better to have a global config file, e.g., .config/machete.toml
  • One kind of false postive is derive macros, e.g., num_trails and serde.
  • Another "false postive" is conditional compilation. But maybe we should have just uses [target.'cfg(target_os = "linux")'.dependencies]

Also, cargo-machete --with-metadata reports something like error: current package believes it's in a workspace when it's not. It may be because we wrongly configured some crates, but I didn't bother to fix it. Fortunately it turns out there aren't many false-postives.

from cargo-machete.

poliorcetics avatar poliorcetics commented on September 15, 2024 2

No public code to show off but cargo machete worked like a charm and managed to find 2 unused deps (including one on an internal crate) which let me remove a build-script, always nice for small compile times wins 🎉

from cargo-machete.

larseggert avatar larseggert commented on September 15, 2024 2

mozilla/neqo#1974

from cargo-machete.

IgnisDa avatar IgnisDa commented on September 15, 2024 1

Been using cargo machete for https://github.com/IgnisDa/ryot for over a year. Really useful tool.

Also love the name!

from cargo-machete.

azzamsa avatar azzamsa commented on September 15, 2024

I'm facing difficulties while trying to install cargo-udeps, as it seems to depend on libssl.so.1.1. I've already installed several SSL-related dependencies on both Ubuntu 22.04 and Debian 12, but I haven't been successful so far.

As a last resort, I'm considering installing libssl.so.1.1 on an Arch container using Distrobox. However, I'm also open to exploring alternatives. Surprisingly, cargo-machete managed to find what cargo-udeps couldn't. 🏆

monorepo-services/alibaba on  alibaba/refactor [!?] is 📦 v0.4.0 via 🦀 v1.71.0
# `cargo-udeps`
    Checking hyosho v0.4.0 (/home/user/projects/monorepo-services/alibaba)
    Finished dev [unoptimized + debuginfo] target(s) in 1.63s
info: Loading depinfo from "/home/user/projects/monorepo-services/alibaba/target/debug/deps/hyosho-14768cb6b
da7830f.d"
info: Loading depinfo from "/home/user/projects/monorepo-services/alibaba/target/debug/deps/hyosho-bc29a72ec
262bf2e.d"
All deps seem to have been used.

# `cargo-machete`
Analyzing dependencies of crates in this directory...
cargo-machete found the following unused dependencies in /home/user/projects/monorepo-services/alibaba:
hyosho -- /home/user/projects/monorepo-services/alibaba/Cargo.toml:
        rand
        url
Done!

from cargo-machete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.