@@ -60,25 +60,45 @@ impl std::error::Error for DirRemoveError {}
6060
6161impl std:: fmt:: Display for DirRemoveError {
6262 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
63- f. write_fmt ( format_args ! ( "failed to remove directory '{}' : {:?}" , self . path, self . kind) )
63+ f. write_fmt ( format_args ! (
64+ "failed to remove directory '{}' : {:?}" ,
65+ self . path, self . kind
66+ ) )
6467 }
6568}
6669
6770pub ( crate ) fn improve_remove_dir_error ( error : std:: io:: Error , path : & Path ) -> std:: io:: Error {
68- std:: io:: Error :: new ( error. kind ( ) , DirRemoveError { kind : error. kind ( ) , path : path. display ( ) . to_string ( ) } )
71+ std:: io:: Error :: new (
72+ error. kind ( ) ,
73+ DirRemoveError {
74+ kind : error. kind ( ) ,
75+ path : path. display ( ) . to_string ( ) ,
76+ } ,
77+ )
6978}
7079
7180#[ test]
7281fn custom_remove_dir_error ( ) {
73-
7482 let path = "test/path" . as_ref ( ) ;
7583
7684 let expected = "failed to remove directory 'test/path' : PermissionDenied" ;
77- let tested = format ! ( "{}" , improve_remove_dir_error( std:: io:: Error :: from( std:: io:: ErrorKind :: PermissionDenied ) , path) ) ;
85+ let tested = format ! (
86+ "{}" ,
87+ improve_remove_dir_error(
88+ std:: io:: Error :: from( std:: io:: ErrorKind :: PermissionDenied ) ,
89+ path
90+ )
91+ ) ;
7892 assert_eq ! ( expected, tested) ;
7993
8094 let expected = "Custom { kind: PermissionDenied, error: DirRemoveError { kind: PermissionDenied, path: \" test/path\" } }" ;
81- let tested = format ! ( "{:?}" , improve_remove_dir_error( std:: io:: Error :: from( std:: io:: ErrorKind :: PermissionDenied ) , path) ) ;
95+ let tested = format ! (
96+ "{:?}" ,
97+ improve_remove_dir_error(
98+ std:: io:: Error :: from( std:: io:: ErrorKind :: PermissionDenied ) ,
99+ path
100+ )
101+ ) ;
82102 assert_eq ! ( expected, tested) ;
83103}
84104
0 commit comments