@@ -13,7 +13,6 @@ use std::path::{Path, PathBuf};
13
13
use std:: process:: Command ;
14
14
use std:: str;
15
15
16
- use rustfmt_lib:: absolute_path;
17
16
use structopt:: StructOpt ;
18
17
19
18
#[ derive( StructOpt , Debug ) ]
@@ -289,7 +288,7 @@ impl Target {
289
288
nested_int_test_files : Option < Vec < PathBuf > > ,
290
289
) -> Self {
291
290
let path = PathBuf :: from ( & target. src_path ) ;
292
- let canonicalized = absolute_path ( & path) . unwrap_or ( path) ;
291
+ let canonicalized = dunce :: canonicalize ( & path) . unwrap_or ( path) ;
293
292
let test_files = nested_int_test_files. unwrap_or_else ( Vec :: new) ;
294
293
295
294
Self {
@@ -389,14 +388,14 @@ fn get_targets_root_only(
389
388
include_nested_test_files : bool ,
390
389
) -> Result < ( ) , io:: Error > {
391
390
let metadata = get_cargo_metadata ( manifest_path, false ) ?;
392
- let workspace_root_path = absolute_path ( PathBuf :: from ( & metadata. workspace_root ) ) ?;
391
+ let workspace_root_path = dunce :: canonicalize ( PathBuf :: from ( & metadata. workspace_root ) ) ?;
393
392
let ( in_workspace_root, current_dir_manifest) = if let Some ( target_manifest) = manifest_path {
394
393
(
395
- workspace_root_path == target_manifest,
396
- absolute_path ( target_manifest) ?,
394
+ workspace_root_path. as_path ( ) == target_manifest,
395
+ dunce :: canonicalize ( target_manifest) ?,
397
396
)
398
397
} else {
399
- let current_dir = absolute_path ( env:: current_dir ( ) ?) ?;
398
+ let current_dir = dunce :: canonicalize ( env:: current_dir ( ) ?) ?;
400
399
(
401
400
workspace_root_path == current_dir,
402
401
current_dir. join ( "Cargo.toml" ) ,
@@ -414,7 +413,7 @@ fn get_targets_root_only(
414
413
. into_iter ( )
415
414
. filter ( |p| {
416
415
in_workspace_root
417
- || absolute_path ( PathBuf :: from ( & p. manifest_path ) ) . unwrap_or_default ( )
416
+ || dunce :: canonicalize ( PathBuf :: from ( & p. manifest_path ) ) . unwrap_or_default ( )
418
417
== current_dir_manifest
419
418
} )
420
419
. map ( |p| p. targets )
@@ -1051,7 +1050,7 @@ mod cargo_fmt_tests {
1051
1050
edition : & str ,
1052
1051
) -> Target {
1053
1052
let path = PathBuf :: from ( src_path) ;
1054
- let canonicalized = absolute_path ( & path) . unwrap_or ( path) ;
1053
+ let canonicalized = dunce :: canonicalize ( & path) . unwrap_or ( path) ;
1055
1054
Target {
1056
1055
path : canonicalized,
1057
1056
kind : String :: from ( kind) ,
0 commit comments