@@ -2,6 +2,8 @@ use std::error::Error as StdError;
2
2
3
3
use serde:: { Deserialize , Serialize } ;
4
4
5
+ type BoxError = Box < dyn StdError + Sync + Send > ;
6
+
5
7
/// Credential provider error type.
6
8
///
7
9
/// `UrlNotSupported` and `NotFound` errors both cause Cargo
@@ -29,7 +31,7 @@ pub enum Error {
29
31
/// The provider failed to perform the operation. Other
30
32
/// providers will not be attempted
31
33
#[ serde( with = "error_serialize" ) ]
32
- Other ( Box < dyn StdError + Sync + Send > ) ,
34
+ Other ( BoxError ) ,
33
35
34
36
/// A new variant was added to this enum since Cargo was built
35
37
#[ serde( other) ]
@@ -123,12 +125,10 @@ mod error_serialize {
123
125
124
126
use serde:: { ser:: SerializeStruct , Deserialize , Deserializer , Serializer } ;
125
127
126
- use crate :: error:: StringTypedError ;
128
+ use super :: BoxError ;
129
+ use super :: StringTypedError ;
127
130
128
- pub fn serialize < S > (
129
- e : & Box < dyn StdError + Send + Sync > ,
130
- serializer : S ,
131
- ) -> Result < S :: Ok , S :: Error >
131
+ pub fn serialize < S > ( e : & BoxError , serializer : S ) -> Result < S :: Ok , S :: Error >
132
132
where
133
133
S : Serializer ,
134
134
{
@@ -146,7 +146,7 @@ mod error_serialize {
146
146
state. end ( )
147
147
}
148
148
149
- pub fn deserialize < ' de , D > ( deserializer : D ) -> Result < Box < dyn StdError + Sync + Send > , D :: Error >
149
+ pub fn deserialize < ' de , D > ( deserializer : D ) -> Result < BoxError , D :: Error >
150
150
where
151
151
D : Deserializer < ' de > ,
152
152
{
0 commit comments