Ever see a #Rust compiler warning with a suggested fix and wish the compiler wou...

@wezm@mastodon.decentralised.social

Ever see a #Rust compiler warning with a suggested fix and wish the compiler would do it for you? Well, good news! `cargo fix`—built into Cargo can do that.

The first screenshot shows a warning about elided lifetimes. The second screenshot shows the code after running `cargo fix`. It has applied the suggestion.

`cargo fix` is conservative, so you will usually need one of the `--allow` options to allow it make change. In my case I had all modified code staged in `git`, so used `--allow-staged`.