@@ -13,7 +13,6 @@ use std::path::{Path, PathBuf};
1313use std:: process:: Command ;
1414use std:: str;
1515
16- use rustfmt_lib:: absolute_path;
1716use structopt:: StructOpt ;
1817
1918#[ derive( StructOpt , Debug ) ]
@@ -289,7 +288,7 @@ impl Target {
289288 nested_int_test_files : Option < Vec < PathBuf > > ,
290289 ) -> Self {
291290 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) ;
293292 let test_files = nested_int_test_files. unwrap_or_else ( Vec :: new) ;
294293
295294 Self {
@@ -389,14 +388,14 @@ fn get_targets_root_only(
389388 include_nested_test_files : bool ,
390389) -> Result < ( ) , io:: Error > {
391390 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 ) ) ?;
393392 let ( in_workspace_root, current_dir_manifest) = if let Some ( target_manifest) = manifest_path {
394393 (
395- workspace_root_path == target_manifest,
396- absolute_path ( target_manifest) ?,
394+ workspace_root_path. as_path ( ) == target_manifest,
395+ dunce :: canonicalize ( target_manifest) ?,
397396 )
398397 } else {
399- let current_dir = absolute_path ( env:: current_dir ( ) ?) ?;
398+ let current_dir = dunce :: canonicalize ( env:: current_dir ( ) ?) ?;
400399 (
401400 workspace_root_path == current_dir,
402401 current_dir. join ( "Cargo.toml" ) ,
@@ -414,7 +413,7 @@ fn get_targets_root_only(
414413 . into_iter ( )
415414 . filter ( |p| {
416415 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 ( )
418417 == current_dir_manifest
419418 } )
420419 . map ( |p| p. targets )
@@ -1051,7 +1050,7 @@ mod cargo_fmt_tests {
10511050 edition : & str ,
10521051 ) -> Target {
10531052 let path = PathBuf :: from ( src_path) ;
1054- let canonicalized = absolute_path ( & path) . unwrap_or ( path) ;
1053+ let canonicalized = dunce :: canonicalize ( & path) . unwrap_or ( path) ;
10551054 Target {
10561055 path : canonicalized,
10571056 kind : String :: from ( kind) ,
0 commit comments