This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree 3 files changed +15
-21
lines changed
3 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -550,18 +550,15 @@ impl ::std::fmt::Display for Id {
550
550
}
551
551
}
552
552
553
- impl :: std:: error:: Error for AError {
554
- fn description ( & self ) -> & str {
555
- match * self {
556
- AError :: MutexPoison => "poison error in a mutex (usually a secondary error)" ,
557
- AError :: Unclassified => "unknown error" ,
558
- }
559
- }
560
- }
553
+ impl :: std:: error:: Error for AError { }
561
554
562
555
impl :: std:: fmt:: Display for AError {
563
556
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter < ' _ > ) -> :: std:: fmt:: Result {
564
- write ! ( f, "{}" , :: std:: error:: Error :: description( self ) )
557
+ let description = match self {
558
+ AError :: MutexPoison => "poison error in a mutex (usually a secondary error)" ,
559
+ AError :: Unclassified => "unknown error" ,
560
+ } ;
561
+ write ! ( f, "{}" , description)
565
562
}
566
563
}
567
564
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ pub enum Error {
127
127
InternalError ( & ' static str ) ,
128
128
}
129
129
130
- impl :: std :: error :: Error for Error {
130
+ impl Error {
131
131
fn description ( & self ) -> & str {
132
132
match * self {
133
133
Error :: OutOfSync ( ref _path_buf) => "file out of sync with filesystem" ,
@@ -148,7 +148,7 @@ impl ::std::error::Error for Error {
148
148
149
149
impl Into < String > for Error {
150
150
fn into ( self ) -> String {
151
- :: std :: error :: Error :: description ( & self ) . to_owned ( )
151
+ self . description ( ) . to_owned ( )
152
152
}
153
153
}
154
154
@@ -166,7 +166,7 @@ impl fmt::Display for Error {
166
166
| Error :: FileNotCached
167
167
| Error :: NoUserDataForFile
168
168
| Error :: Io ( ..)
169
- | Error :: BadFileKind => f. write_str ( :: std :: error :: Error :: description ( self ) ) ,
169
+ | Error :: BadFileKind => f. write_str ( self . description ( ) ) ,
170
170
}
171
171
}
172
172
}
Original file line number Diff line number Diff line change @@ -25,21 +25,18 @@ pub enum UrlFileParseError {
25
25
InvalidFilePath ,
26
26
}
27
27
28
- impl Error for UrlFileParseError {
29
- fn description ( & self ) -> & str {
30
- match * self {
31
- UrlFileParseError :: InvalidScheme => "URI scheme is not `file`" ,
32
- UrlFileParseError :: InvalidFilePath => "Invalid file path in URI" ,
33
- }
34
- }
35
- }
28
+ impl Error for UrlFileParseError { }
36
29
37
30
impl fmt:: Display for UrlFileParseError
38
31
where
39
32
UrlFileParseError : Error ,
40
33
{
41
34
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
42
- write ! ( f, "{}" , self . description( ) )
35
+ let description = match self {
36
+ UrlFileParseError :: InvalidScheme => "URI scheme is not `file`" ,
37
+ UrlFileParseError :: InvalidFilePath => "Invalid file path in URI" ,
38
+ } ;
39
+ write ! ( f, "{}" , description)
43
40
}
44
41
}
45
42
You can’t perform that action at this time.
0 commit comments