File tree 3 files changed +7
-11
lines changed
3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -341,10 +341,10 @@ fn format(
341
341
342
342
for file in files {
343
343
if !file. exists ( ) {
344
- eprintln ! ( "Error: file `{}` does not exist" , file. to_str ( ) . unwrap ( ) ) ;
344
+ eprintln ! ( "Error: file `{}` does not exist" , file. display ( ) ) ;
345
345
session. add_operational_error ( ) ;
346
346
} else if file. is_dir ( ) {
347
- eprintln ! ( "Error: `{}` is a directory" , file. to_str ( ) . unwrap ( ) ) ;
347
+ eprintln ! ( "Error: `{}` is a directory" , file. display ( ) ) ;
348
348
session. add_operational_error ( ) ;
349
349
} else {
350
350
// 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 {
38
38
impl fmt:: Display for FileName {
39
39
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
40
40
match self {
41
- FileName :: Real ( p) => write ! ( f, "{}" , p. to_str ( ) . unwrap ( ) ) ,
41
+ FileName :: Real ( p) => write ! ( f, "{}" , p. display ( ) ) ,
42
42
FileName :: Stdin => write ! ( f, "<stdin>" ) ,
43
43
}
44
44
}
Original file line number Diff line number Diff line change @@ -105,10 +105,9 @@ fn is_file_skip(path: &Path) -> bool {
105
105
fn get_test_files ( path : & Path , recursive : bool ) -> Vec < PathBuf > {
106
106
let mut files = vec ! [ ] ;
107
107
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
+ {
112
111
let entry = entry. expect ( "couldn't get `DirEntry`" ) ;
113
112
let path = entry. path ( ) ;
114
113
if path. is_dir ( ) && recursive {
@@ -122,10 +121,7 @@ fn get_test_files(path: &Path, recursive: bool) -> Vec<PathBuf> {
122
121
}
123
122
124
123
fn 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( ) ) ) {
129
125
let entry = entry. expect ( "couldn't get directory entry" ) ;
130
126
let path = entry. path ( ) ;
131
127
if path. extension ( ) . map_or ( false , |f| f == "rs" ) {
You can’t perform that action at this time.
0 commit comments