File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -3798,8 +3798,10 @@ mod tests {
3798
3798
( config, _, _) = config. apply_change ( change) ;
3799
3799
3800
3800
assert_eq ! ( config. cargo_targetDir( None ) , & Some ( TargetDirectory :: UseSubdirectory ( true ) ) ) ;
3801
+ let target =
3802
+ Utf8PathBuf :: from ( std:: env:: var ( "CARGO_TARGET_DIR" ) . unwrap_or ( "target" . to_string ( ) ) ) ;
3801
3803
assert ! (
3802
- matches!( config. flycheck( None ) , FlycheckConfig :: CargoCommand { options, .. } if options. target_dir == Some ( Utf8PathBuf :: from ( "target/ rust-analyzer") ) )
3804
+ matches!( config. flycheck( None ) , FlycheckConfig :: CargoCommand { options, .. } if options. target_dir == Some ( target . join ( " rust-analyzer") ) )
3803
3805
) ;
3804
3806
}
3805
3807
Original file line number Diff line number Diff line change @@ -396,12 +396,19 @@ pub fn skip_slow_tests() -> bool {
396
396
if should_skip {
397
397
eprintln ! ( "ignoring slow test" ) ;
398
398
} else {
399
- let path = project_root ( ) . join ( "./target/ .slow_tests_cookie" ) ;
399
+ let path = target_dir ( ) . join ( ".slow_tests_cookie" ) ;
400
400
fs:: write ( path, "." ) . unwrap ( ) ;
401
401
}
402
402
should_skip
403
403
}
404
404
405
+ pub fn target_dir ( ) -> Utf8PathBuf {
406
+ match std:: env:: var ( "CARGO_TARGET_DIR" ) {
407
+ Ok ( target) => Utf8PathBuf :: from ( target) ,
408
+ Err ( _) => project_root ( ) . join ( "target" ) ,
409
+ }
410
+ }
411
+
405
412
/// Returns the path to the root directory of `rust-analyzer` project.
406
413
pub fn project_root ( ) -> Utf8PathBuf {
407
414
let dir = env ! ( "CARGO_MANIFEST_DIR" ) ;
You can’t perform that action at this time.
0 commit comments