Hello, I'm new to Rust and have started my first project which uses the flate2 crate.
Whenever I edit my own code and run cargo build, all dependencies appear to get recompiled. Is this normal behavior or a bug? I found an issue on GitHub, but it seems to be resolved.
Below the output of a project created via cargo new testapp --bin. Only Cargo.toml has been modified to contain flate2 as a dependency. Between each build, main.rs is modified, e.g. by adding a blank line:
user@host:/tmp/testapp$ cargo build
Blocking waiting for file lock on build directory
Compiling gcc v0.3.35
Compiling libc v0.2.16
Compiling miniz-sys v0.1.7
Compiling flate2 v0.2.14
Compiling testapp v0.1.0 (file:///tmp/testapp)
Finished debug [unoptimized + debuginfo] target(s) in 4.20 secs
# --- no change to main.rs here --
user@host:/tmp/testapp$ cargo build
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
# --- main.rs modified here --
user@host:/tmp/testapp$ cargo build
Blocking waiting for file lock on build directory
Compiling gcc v0.3.35
Compiling libc v0.2.16
Compiling miniz-sys v0.1.7
Compiling flate2 v0.2.14
Compiling testapp v0.1.0 (file:///tmp/testapp)
Finished debug [unoptimized + debuginfo] target(s) in 4.15 secs
Do you have something compiling in the background? Like an editor plugin, perhaps with a different version of rustc? That would definitely cause cargo to redo everything with different compilers.
@cuviper, @codingcampbell: I think you guys were on the right track. I'm using Atom with the Rust linter and if I edit main.rs with a plain text editor, the behavior is as in steveklabnik's demonstration.
I had already disabled Atom's Racer plugin, which I suspected could be responsible due to the local files is creates when running. I felt certain the other Rust related tools wouldn't have such an effect, but apparently they do.
Hopefully the aforementioned changes to cargo will affect this issue. Thanks for the help!
Re-upping for reference: it is the Atom Linter plugin, which has a flag to use Cargo if it's available for linting. If you use it (e.g. with cargo clippy, cargo check, etc.), it will apparently make a nice mess of your .cargo directory and trigger this rebuilding issue. Gladly, it should be gone by the end of the year; and I may just be running on nightly for a little while for this alone.