Closed
Description
Problem
Re-saving a file but not changing its contents causes cargo to recompile the project.
This doesn't follow what's written in the Rust Programming Language book:
Cargo figured out that the files hadn’t changed, so it just ran the binary. If you had modified your source code, Cargo would have rebuilt the project before running
Steps
- Create a new project and build it
cargo new hello
cd hello
cargo build
- Open
main.rs
and re-save it, e.g. withvim src/main.rs
and:wq
- Run another
cargo build
Cargo will show a "Compiling" phase before "Finished" as if the file had changed.
Possible Solution(s)
Not sure what the current implementation is but perhaps it's considering the timestamp at which files were modified?
Notes
Output of cargo version
:
cargo 1.45.1 (f242df6ed 2020-07-22)
I am on WSL running Ubuntu 20.04.