@@ -17,11 +17,11 @@ pub enum Error {
1717 #[ error( "version '{0}' is invalid" ) ]
1818 InvalidVersion ( String ) ,
1919 /// IO error
20- #[ error( transparent ) ]
21- IoError ( anyhow :: Error ) ,
20+ #[ error( "{0}" ) ]
21+ IoError ( String ) ,
2222 /// Parse error
23- #[ error( transparent ) ]
24- ParseError ( anyhow :: Error ) ,
23+ #[ error( "{0}" ) ]
24+ ParseError ( String ) ,
2525 /// Poisoned lock
2626 #[ error( "poisoned lock '{0}'" ) ]
2727 PoisonedLock ( String ) ,
@@ -51,70 +51,63 @@ pub enum Error {
5151/// Converts a [`regex::Error`] into an [`ParseError`](Error::ParseError)
5252impl From < regex:: Error > for Error {
5353 fn from ( error : regex:: Error ) -> Self {
54- Error :: ParseError ( error. into ( ) )
54+ Error :: ParseError ( error. to_string ( ) )
5555 }
5656}
5757
5858/// Converts a [`reqwest::Error`] into an [`IoError`](Error::IoError)
5959impl From < reqwest:: Error > for Error {
6060 fn from ( error : reqwest:: Error ) -> Self {
61- Error :: IoError ( error. into ( ) )
61+ Error :: IoError ( error. to_string ( ) )
6262 }
6363}
6464
6565/// Converts a [`reqwest_middleware::Error`] into an [`IoError`](Error::IoError)
6666impl From < reqwest_middleware:: Error > for Error {
6767 fn from ( error : reqwest_middleware:: Error ) -> Self {
68- Error :: IoError ( error. into ( ) )
68+ Error :: IoError ( error. to_string ( ) )
6969 }
7070}
7171
7272/// Converts a [`std::io::Error`] into an [`IoError`](Error::IoError)
7373impl From < std:: io:: Error > for Error {
7474 fn from ( error : std:: io:: Error ) -> Self {
75- Error :: IoError ( error. into ( ) )
75+ Error :: IoError ( error. to_string ( ) )
7676 }
7777}
7878
7979/// Converts a [`std::time::SystemTimeError`] into an [`IoError`](Error::IoError)
8080impl From < std:: time:: SystemTimeError > for Error {
8181 fn from ( error : std:: time:: SystemTimeError ) -> Self {
82- Error :: IoError ( error. into ( ) )
82+ Error :: IoError ( error. to_string ( ) )
8383 }
8484}
8585
8686/// Converts a [`std::num::ParseIntError`] into an [`ParseError`](Error::ParseError)
8787impl From < std:: num:: ParseIntError > for Error {
8888 fn from ( error : std:: num:: ParseIntError ) -> Self {
89- Error :: ParseError ( error. into ( ) )
89+ Error :: ParseError ( error. to_string ( ) )
9090 }
9191}
9292
9393/// Converts a [`semver::Error`] into an [`ParseError`](Error::ParseError)
9494impl From < semver:: Error > for Error {
9595 fn from ( error : semver:: Error ) -> Self {
96- Error :: IoError ( error. into ( ) )
96+ Error :: IoError ( error. to_string ( ) )
9797 }
9898}
9999
100100/// Converts a [`std::path::StripPrefixError`] into an [`ParseError`](Error::ParseError)
101101impl From < std:: path:: StripPrefixError > for Error {
102102 fn from ( error : std:: path:: StripPrefixError ) -> Self {
103- Error :: ParseError ( error. into ( ) )
104- }
105- }
106-
107- /// Converts a [`anyhow::Error`] into an [`Unexpected`](Error::Unexpected)
108- impl From < anyhow:: Error > for Error {
109- fn from ( error : anyhow:: Error ) -> Self {
110- Error :: Unexpected ( error. to_string ( ) )
103+ Error :: ParseError ( error. to_string ( ) )
111104 }
112105}
113106
114107/// Converts a [`url::ParseError`] into an [`ParseError`](Error::ParseError)
115108impl From < url:: ParseError > for Error {
116109 fn from ( error : url:: ParseError ) -> Self {
117- Error :: ParseError ( error. into ( ) )
110+ Error :: ParseError ( error. to_string ( ) )
118111 }
119112}
120113
@@ -200,13 +193,6 @@ mod test {
200193 ) ;
201194 }
202195
203- #[ test]
204- fn test_from_anyhow_error ( ) {
205- let anyhow_error = anyhow:: Error :: msg ( "test" ) ;
206- let error = Error :: from ( anyhow_error) ;
207- assert_eq ! ( error. to_string( ) , "test" ) ;
208- }
209-
210196 #[ test]
211197 fn test_from_url_parse_error ( ) {
212198 let parse_error = url:: ParseError :: EmptyHost ;
0 commit comments