@@ -318,7 +318,7 @@ pub fn read_dir_if_exists<P: AsRef<AbsNormPath>>(path: P) -> Result<Option<ReadD
318
318
pub fn try_exists < P : AsRef < AbsPath > > ( path : P ) -> Result < bool , IoError > {
319
319
let _guard = IoCounterKey :: Stat . guard ( ) ;
320
320
make_error ! (
321
- fs :: try_exists ( path. as_ref( ) . as_maybe_relativized( ) ) ,
321
+ path. as_ref( ) . as_maybe_relativized( ) . try_exists ( ) ,
322
322
format!( "try_exists({})" , P :: as_ref( & path) . display( ) )
323
323
)
324
324
}
@@ -1060,7 +1060,7 @@ mod tests {
1060
1060
let dir_path = root. join ( "dir" ) ;
1061
1061
create_dir_all ( AbsPath :: new ( & dir_path) ?) ?;
1062
1062
assert_matches ! ( remove_file( & dir_path) , Err ( ..) ) ;
1063
- assert ! ( fs :: try_exists( & dir_path ) ?) ;
1063
+ assert ! ( dir_path . try_exists( ) ?) ;
1064
1064
Ok ( ( ) )
1065
1065
}
1066
1066
@@ -1102,7 +1102,7 @@ mod tests {
1102
1102
let path = root. join ( "file" ) ;
1103
1103
fs:: write ( & path, b"regular" ) ?;
1104
1104
remove_all ( & path) ?;
1105
- assert ! ( !fs :: try_exists( & path ) ?) ;
1105
+ assert ! ( !path . try_exists( ) ?) ;
1106
1106
Ok ( ( ) )
1107
1107
}
1108
1108
@@ -1114,7 +1114,7 @@ mod tests {
1114
1114
fs:: create_dir ( & path) ?;
1115
1115
fs:: write ( path. join ( "file" ) , b"regular file in a dir" ) ?;
1116
1116
remove_all ( & path) ?;
1117
- assert ! ( !fs :: try_exists( & path ) ?) ;
1117
+ assert ! ( !path . try_exists( ) ?) ;
1118
1118
Ok ( ( ) )
1119
1119
}
1120
1120
@@ -1163,7 +1163,7 @@ mod tests {
1163
1163
let file_path = root. join ( "file" ) ;
1164
1164
fs:: write ( & file_path, b"File content" ) ?;
1165
1165
assert ! ( remove_dir_all( & file_path) . is_err( ) ) ;
1166
- assert ! ( fs :: try_exists( & file_path ) ?) ;
1166
+ assert ! ( file_path . try_exists( ) ?) ;
1167
1167
Ok ( ( ) )
1168
1168
}
1169
1169
0 commit comments