Cargo workspaces: dependency updates


I am starting a new project in rust and I decided to split it up into multiple crates to increase compile times and modularity.

Now I have a problem regarding to dependency versions. Lets assume I have two libraries in my workspace called libA and libB. Both of them have a dependency on lets say num v0.1.37. These dependencies are written into the Cargo.toml of each of the two crates.
Now when I want to update to a more recent version of num, then I have to update both crates. The problem is, that num is used in almost all of my crates (9 approximated). Updating all of them can be some perhaps unnecessary work.

Now the question is: Should I use the num = “0.1.*” syntax, because that should update all my crates to the same version with cargo update?


The default dependency versions are not strict, but rather based on semver, the same as caret requirements. So if different crates list “0.1.15”, “0.1.29”, “0.1.34”, then on cargo update they’ll all get resolved to the latest “0.1.x” release. You only need to update their Cargo.toml if their minimum requirement changes due to using some new feature.


Thanks for the fast response :smiley:

I did not realize that semver is that amazing :+1: