@@ -25,44 +25,21 @@ impl<E> From<E> for DecodeError<E> {
2525}
2626
2727#[ cfg( feature = "serde1" ) ]
28- #[ cfg( feature = "use_std" ) ]
29- impl < E : std:: error:: Error + ' static > serde:: de:: Error for DecodeError < E > {
28+ impl < E : core:: error:: Error + ' static > serde:: de:: Error for DecodeError < E > {
3029 fn custom < T : fmt:: Display > ( msg : T ) -> Self {
3130 DecodeError :: Custom ( msg. to_string ( ) . into_boxed_str ( ) )
3231 }
3332}
3433
35- #[ cfg( feature = "serde1" ) ]
36- #[ cfg( not( feature = "use_std" ) ) ]
37- impl < E : fmt:: Debug > serde:: de:: Error for DecodeError < E > {
38- fn custom < T : fmt:: Display > ( msg : T ) -> Self {
39- #[ cfg( not( feature = "use_std" ) ) ]
40- use crate :: alloc:: string:: ToString ;
41-
42- DecodeError :: Custom ( msg. to_string ( ) . into_boxed_str ( ) )
43- }
44- }
45-
4634impl < E : fmt:: Debug > fmt:: Display for DecodeError < E > {
4735 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
4836 fmt:: Debug :: fmt ( self , f)
4937 }
5038}
5139
5240#[ cfg( feature = "serde1" ) ]
53- #[ cfg( not( feature = "use_std" ) ) ]
5441impl < E : fmt:: Debug > serde:: ser:: StdError for DecodeError < E > { }
5542
56- #[ cfg( feature = "use_std" ) ]
57- impl < E : std:: error:: Error + ' static > std:: error:: Error for DecodeError < E > {
58- fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
59- match self {
60- DecodeError :: Core ( err) => Some ( err) ,
61- _ => None
62- }
63- }
64- }
65-
6643#[ derive( Debug ) ]
6744pub enum EncodeError < E > {
6845 Core ( enc:: Error < E > ) ,
@@ -86,40 +63,17 @@ impl<E> From<E> for EncodeError<E> {
8663}
8764
8865#[ cfg( feature = "serde1" ) ]
89- #[ cfg( feature = "use_std" ) ]
90- impl < E : std:: error:: Error + ' static > serde:: ser:: Error for EncodeError < E > {
66+ impl < E : core:: error:: Error + ' static > serde:: ser:: Error for EncodeError < E > {
9167 fn custom < T : fmt:: Display > ( msg : T ) -> Self {
9268 EncodeError :: Custom ( msg. to_string ( ) . into_boxed_str ( ) )
9369 }
9470}
9571
96- #[ cfg( feature = "serde1" ) ]
97- #[ cfg( not( feature = "use_std" ) ) ]
98- impl < E : fmt:: Debug > serde:: ser:: Error for EncodeError < E > {
99- fn custom < T : fmt:: Display > ( msg : T ) -> Self {
100- #[ cfg( not( feature = "use_std" ) ) ]
101- use crate :: alloc:: string:: ToString ;
102-
103- EncodeError :: Custom ( msg. to_string ( ) . into_boxed_str ( ) )
104- }
105- }
106-
10772impl < E : fmt:: Debug > fmt:: Display for EncodeError < E > {
10873 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10974 fmt:: Debug :: fmt ( self , f)
11075 }
11176}
11277
11378#[ cfg( feature = "serde1" ) ]
114- #[ cfg( not( feature = "use_std" ) ) ]
11579impl < E : fmt:: Debug > serde:: ser:: StdError for EncodeError < E > { }
116-
117- #[ cfg( feature = "use_std" ) ]
118- impl < E : std:: error:: Error + ' static > std:: error:: Error for EncodeError < E > {
119- fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
120- match self {
121- EncodeError :: Core ( err) => Some ( err) ,
122- _ => None
123- }
124- }
125- }
0 commit comments