Fix run-pass tests when CARGO_TARGET_DIR is not set

This commit is contained in:
flip1995 2020-02-10 15:51:51 +01:00
parent c066807a70
commit f940b04de6
No known key found for this signature in database
GPG key ID: 693086869D506637

View file

@ -1,3 +1,4 @@
use cargo_metadata::MetadataCommand;
use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
@ -6,7 +7,7 @@ lazy_static! {
pub static ref CARGO_TARGET_DIR: PathBuf = {
match env::var_os("CARGO_TARGET_DIR") {
Some(v) => v.into(),
None => "target".into(),
None => MetadataCommand::new().exec().unwrap().target_directory,
}
};
pub static ref TARGET_LIB: PathBuf = {