@@ -1033,14 +1033,16 @@ impl Metadata {
1033
1033
/// [`is_dir`], and will be false for symlink metadata
1034
1034
/// obtained from [`symlink_metadata`].
1035
1035
///
1036
- /// This property means it is often more useful to use `!file_type.is_dir()`
1037
- /// than `file_type.is_file()` when your goal is to read bytes from a
1038
- /// source: the former includes symlink and pipes when the latter does not,
1039
- /// meaning you will break workflows like `diff <( prog_a ) <( prog_b )` on
1040
- /// a Unix-like system for example .
1036
+ /// When the goal is simply to read from (or write to) the source, the most
1037
+ /// reliable way to test the source can be read (or written to) is to open
1038
+ /// it. Only using `is_file` can break workflows like `diff <( prog_a )` on
1039
+ /// a Unix- like system for example. See [`File::open`] or
1040
+ /// [`OpenOptions::open`] for more information .
1041
1041
///
1042
1042
/// [`is_dir`]: struct.Metadata.html#method.is_dir
1043
1043
/// [`symlink_metadata`]: fn.symlink_metadata.html
1044
+ /// [`File::open`]: struct.File.html#method.open
1045
+ /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
1044
1046
///
1045
1047
/// # Examples
1046
1048
///
@@ -1313,14 +1315,16 @@ impl FileType {
1313
1315
/// [`is_dir`] and [`is_symlink`]; only zero or one of these
1314
1316
/// tests may pass.
1315
1317
///
1316
- /// This property means it is often more useful to use `!file_type.is_dir()`
1317
- /// than `file_type.is_file()` when your goal is to read bytes from a
1318
- /// source: the former includes symlink and pipes when the latter does not,
1319
- /// meaning you will break workflows like `diff <( prog_a ) <( prog_b )` on
1320
- /// a Unix-like system for example .
1318
+ /// When the goal is simply to read from (or write to) the source, the most
1319
+ /// reliable way to test the source can be read (or written to) is to open
1320
+ /// it. Only using `is_file` can break workflows like `diff <( prog_a )` on
1321
+ /// a Unix- like system for example. See [`File::open`] or
1322
+ /// [`OpenOptions::open`] for more information .
1321
1323
///
1322
1324
/// [`is_dir`]: struct.FileType.html#method.is_dir
1323
1325
/// [`is_symlink`]: struct.FileType.html#method.is_symlink
1326
+ /// [`File::open`]: struct.File.html#method.open
1327
+ /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
1324
1328
///
1325
1329
/// # Examples
1326
1330
///
0 commit comments