cargo-tree icon indicating copy to clipboard operation
cargo-tree copied to clipboard

Exit with an error when duplicates are found

Open sanxiyn opened this issue 4 years ago • 1 comments

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.

sanxiyn avatar Jan 03 '20 05:01 sanxiyn

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.

joshtriplett avatar Feb 26 '20 22:02 joshtriplett