File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -439,19 +439,19 @@ impl Cmd {
439439 return Err ( Error :: new ( ErrorKind :: Other , err_msg) ) ;
440440 }
441441
442- let dir = & self . args [ 1 ] ;
443- if !std :: path :: Path :: new ( & dir) . is_dir ( ) {
444- let err_msg = format ! ( "cd: {:? }: No such file or directory" , dir) ;
442+ let dir = PathBuf :: from ( & self . args [ 1 ] ) ;
443+ if !dir. is_dir ( ) {
444+ let err_msg = format ! ( "cd { }: No such file or directory" , dir. display ( ) ) ;
445445 error ! ( "{}" , err_msg) ;
446446 return Err ( Error :: new ( ErrorKind :: Other , err_msg) ) ;
447447 }
448448
449- if let Err ( e) = Path :: new ( dir) . access ( AccessMode :: EXECUTE ) {
450- error ! ( "cd {:? }: {}" , dir, e) ;
449+ if let Err ( e) = dir. access ( AccessMode :: EXECUTE ) {
450+ error ! ( "cd {}: {}" , dir. display ( ) , e) ;
451451 return Err ( e) ;
452452 }
453453
454- * current_dir = PathBuf :: from ( dir) ;
454+ * current_dir = dir;
455455 Ok ( ( ) )
456456 }
457457
You can’t perform that action at this time.
0 commit comments