File tree Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -341,10 +341,10 @@ fn format(
341341
342342 for file in files {
343343 if !file. exists ( ) {
344- eprintln ! ( "Error: file `{}` does not exist" , file. to_str ( ) . unwrap ( ) ) ;
344+ eprintln ! ( "Error: file `{}` does not exist" , file. display ( ) ) ;
345345 session. add_operational_error ( ) ;
346346 } else if file. is_dir ( ) {
347- eprintln ! ( "Error: `{}` is a directory" , file. to_str ( ) . unwrap ( ) ) ;
347+ eprintln ! ( "Error: `{}` is a directory" , file. display ( ) ) ;
348348 session. add_operational_error ( ) ;
349349 } else {
350350 // Check the file directory if the config-path could not be read or not provided
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ impl From<rustc_span::FileName> for FileName {
3838impl fmt:: Display for FileName {
3939 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4040 match self {
41- FileName :: Real ( p) => write ! ( f, "{}" , p. to_str ( ) . unwrap ( ) ) ,
41+ FileName :: Real ( p) => write ! ( f, "{}" , p. display ( ) ) ,
4242 FileName :: Stdin => write ! ( f, "<stdin>" ) ,
4343 }
4444 }
Original file line number Diff line number Diff line change @@ -105,10 +105,9 @@ fn is_file_skip(path: &Path) -> bool {
105105fn get_test_files ( path : & Path , recursive : bool ) -> Vec < PathBuf > {
106106 let mut files = vec ! [ ] ;
107107 if path. is_dir ( ) {
108- for entry in fs:: read_dir ( path) . expect ( & format ! (
109- "couldn't read directory {}" ,
110- path. to_str( ) . unwrap( )
111- ) ) {
108+ for entry in
109+ fs:: read_dir ( path) . expect ( & format ! ( "couldn't read directory {}" , path. display( ) ) )
110+ {
112111 let entry = entry. expect ( "couldn't get `DirEntry`" ) ;
113112 let path = entry. path ( ) ;
114113 if path. is_dir ( ) && recursive {
@@ -122,10 +121,7 @@ fn get_test_files(path: &Path, recursive: bool) -> Vec<PathBuf> {
122121}
123122
124123fn verify_config_used ( path : & Path , config_name : & str ) {
125- for entry in fs:: read_dir ( path) . expect ( & format ! (
126- "couldn't read {} directory" ,
127- path. to_str( ) . unwrap( )
128- ) ) {
124+ for entry in fs:: read_dir ( path) . expect ( & format ! ( "couldn't read {} directory" , path. display( ) ) ) {
129125 let entry = entry. expect ( "couldn't get directory entry" ) ;
130126 let path = entry. path ( ) ;
131127 if path. extension ( ) . map_or ( false , |f| f == "rs" ) {
You can’t perform that action at this time.
0 commit comments