TIL: Interactive Development in Rust with Cargo Watch
I like the fast feedback loop you get in Rust when combining the excellent type system with editor hints through rust-analyzer and rust-tools. Still, I want to run my code often to get the feedback I need for development. Then, I miss the fast feedback loop of developing Python in REPL environments (IPython, Jupyter, run script continuously).
cargo watch
to the rescue! With smaller code bases such as advent of code problems or exploring new libraries, the Rust compiler is plenty fast for almost immediate feedback.
Running:
cargo watch -x clippy -x run
in a split pane to execute clippy
and run the binary on every file change gives fast feedback without additional, manual steps.
Have a look: