sfackler / cargo-tree

Apache License 2.0
529 stars 39 forks source link

Exit with an error when duplicates are found #87

Open sanxiyn opened 4 years ago

sanxiyn commented 4 years ago

I want to use cargo tree -d in a CI. It would be nice if cargo-tree exit with success (exit code 0) when there are no duplicates and exit with failure (exit code 1) when duplicates are found.

joshtriplett commented 4 years ago

We discussed this a bit in the cargo team meeting today. We'd love to have an option for a "gentler" version of this, which doesn't fail unless you can actually fix the problem without having to fix your dependencies. The algorithm would be "pretend that all of your direct declared dependencies (and also dependencies from crates in your workspace or that use path dependencies) that use ~ (semver compatible) used >= instead, resolve dependencies accordingly, and if that would eliminate a duplicate, report it as a failure".

That way, you don't get a CI failure for something that you can't actually fix yourself by just fixing your Cargo.toml.