Use $CARGO_TARGET_(TMP)DIR, if set, for test directories
Use $CARGO_TARGET_(TMP)DIR, if set, for test directories

If $CARGO_TARGET_DIR is set in the environment, the generated directory
structures for testing should be placed in there.  This allows for use
cases such as a read-only source directory.

If a new enough cargo is being used such that $CARGO_TARGET_TMPDIR is
available, prefer to use that instead since its explicit use is for test
artifacts.

whitequark/rust-xdg