[SOLVED] Update Cargo.toml after "cargo update"



sorry if this was previously discussed.

Let’s say I have a project which a lot of dependencies defined in Cargo.toml.

After six months I decide to update all dependendencies and see what happens: I run cargo update, the file Cargo.lock is updated.

I test my application and everything is fine: now I’d like to update my Cargo.toml to reflect the updated packages that I know are now working.

How can I do that without manually editing the file?


Cargo update works within constrains defined by Cargo.toml. Once it will update Cargo.lock, there is nothing else you need to do to Cargo.toml.

If you want to see what’s available outside of those constraints, use cargo outdated.


As mentioned Cargo.lock is the file for tracking known working dependencies. However, if you do want to update the minimum versions of your dependencies (e.g. you don’t know whether you’re accidentally using functionality from a newer version) then cargo-edit’s cargo upgrade should be able to do that for you.


cargo upgrade - the tool I was looking for.

I was about to crack that up with some scripting reading from cargo-metadata and comparing with my Cargo.toml.

Awesome, thanks!