Skip to content

Commit c18ebbe

Browse files
Merge pull request andrewhickman#52 from brooksprumo/glob
Removes glob import of ErrorKind within Display
2 parents ba98887 + c24e914 commit c18ebbe

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

src/errors.rs

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,40 +63,42 @@ impl Error {
6363

6464
impl fmt::Display for Error {
6565
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
66-
use ErrorKind::*;
66+
use ErrorKind as E;
6767

6868
let path = self.path.display();
6969

7070
match self.kind {
71-
OpenFile => write!(formatter, "failed to open file `{}`", path),
72-
CreateFile => write!(formatter, "failed to create file `{}`", path),
73-
CreateDir => write!(formatter, "failed to create directory `{}`", path),
74-
SyncFile => write!(formatter, "failed to sync file `{}`", path),
75-
SetLen => write!(formatter, "failed to set length of file `{}`", path),
76-
Metadata => write!(formatter, "failed to query metadata of file `{}`", path),
77-
Clone => write!(formatter, "failed to clone handle for file `{}`", path),
78-
SetPermissions => write!(formatter, "failed to set permissions for file `{}`", path),
79-
Read => write!(formatter, "failed to read from file `{}`", path),
80-
Seek => write!(formatter, "failed to seek in file `{}`", path),
81-
Write => write!(formatter, "failed to write to file `{}`", path),
82-
Flush => write!(formatter, "failed to flush file `{}`", path),
83-
ReadDir => write!(formatter, "failed to read directory `{}`", path),
84-
RemoveFile => write!(formatter, "failed to remove file `{}`", path),
85-
RemoveDir => write!(formatter, "failed to remove directory `{}`", path),
86-
Canonicalize => write!(formatter, "failed to canonicalize path `{}`", path),
87-
ReadLink => write!(formatter, "failed to read symbolic link `{}`", path),
88-
SymlinkMetadata => write!(formatter, "failed to query metadata of symlink `{}`", path),
89-
FileExists => write!(formatter, "failed to check file existance `{}`", path),
71+
E::OpenFile => write!(formatter, "failed to open file `{}`", path),
72+
E::CreateFile => write!(formatter, "failed to create file `{}`", path),
73+
E::CreateDir => write!(formatter, "failed to create directory `{}`", path),
74+
E::SyncFile => write!(formatter, "failed to sync file `{}`", path),
75+
E::SetLen => write!(formatter, "failed to set length of file `{}`", path),
76+
E::Metadata => write!(formatter, "failed to query metadata of file `{}`", path),
77+
E::Clone => write!(formatter, "failed to clone handle for file `{}`", path),
78+
E::SetPermissions => write!(formatter, "failed to set permissions for file `{}`", path),
79+
E::Read => write!(formatter, "failed to read from file `{}`", path),
80+
E::Seek => write!(formatter, "failed to seek in file `{}`", path),
81+
E::Write => write!(formatter, "failed to write to file `{}`", path),
82+
E::Flush => write!(formatter, "failed to flush file `{}`", path),
83+
E::ReadDir => write!(formatter, "failed to read directory `{}`", path),
84+
E::RemoveFile => write!(formatter, "failed to remove file `{}`", path),
85+
E::RemoveDir => write!(formatter, "failed to remove directory `{}`", path),
86+
E::Canonicalize => write!(formatter, "failed to canonicalize path `{}`", path),
87+
E::ReadLink => write!(formatter, "failed to read symbolic link `{}`", path),
88+
E::SymlinkMetadata => {
89+
write!(formatter, "failed to query metadata of symlink `{}`", path)
90+
}
91+
E::FileExists => write!(formatter, "failed to check file existance `{}`", path),
9092

9193
#[cfg(windows)]
92-
SeekRead => write!(formatter, "failed to seek and read from `{}`", path),
94+
E::SeekRead => write!(formatter, "failed to seek and read from `{}`", path),
9395
#[cfg(windows)]
94-
SeekWrite => write!(formatter, "failed to seek and write to `{}`", path),
96+
E::SeekWrite => write!(formatter, "failed to seek and write to `{}`", path),
9597

9698
#[cfg(unix)]
97-
ReadAt => write!(formatter, "failed to read with offset from `{}`", path),
99+
E::ReadAt => write!(formatter, "failed to read with offset from `{}`", path),
98100
#[cfg(unix)]
99-
WriteAt => write!(formatter, "failed to write with offset to `{}`", path),
101+
E::WriteAt => write!(formatter, "failed to write with offset to `{}`", path),
100102
}
101103
}
102104
}

0 commit comments

Comments
 (0)