@@ -65,6 +65,11 @@ use core::{
65
65
ops:: Deref ,
66
66
} ;
67
67
68
+ #[ cfg( zerocopy_core_error) ]
69
+ use core:: error:: Error ;
70
+ #[ cfg( all( not( zerocopy_core_error) , any( feature = "std" , test) ) ) ]
71
+ use std:: error:: Error ;
72
+
68
73
use crate :: { util:: SendSyncPhantomData , KnownLayout , TryFromBytes } ;
69
74
#[ cfg( doc) ]
70
75
use crate :: { FromBytes , Ref } ;
@@ -126,9 +131,8 @@ impl<A: fmt::Display, S: fmt::Display, V: fmt::Display> fmt::Display for Convert
126
131
}
127
132
}
128
133
129
- #[ cfg( any( feature = "std" , test) ) ]
130
- #[ allow( clippy:: std_instead_of_core) ]
131
- impl < A , S , V > std:: error:: Error for ConvertError < A , S , V >
134
+ #[ cfg( any( zerocopy_core_error, feature = "std" , test) ) ]
135
+ impl < A , S , V > Error for ConvertError < A , S , V >
132
136
where
133
137
A : fmt:: Display + fmt:: Debug ,
134
138
S : fmt:: Display + fmt:: Debug ,
@@ -228,9 +232,8 @@ where
228
232
}
229
233
}
230
234
231
- #[ cfg( any( feature = "std" , test) ) ]
232
- #[ allow( clippy:: std_instead_of_core) ]
233
- impl < Src , Dst : ?Sized > std:: error:: Error for AlignmentError < Src , Dst >
235
+ #[ cfg( any( zerocopy_core_error, feature = "std" , test) ) ]
236
+ impl < Src , Dst : ?Sized > Error for AlignmentError < Src , Dst >
234
237
where
235
238
Src : Deref ,
236
239
Dst : KnownLayout ,
@@ -353,9 +356,8 @@ where
353
356
}
354
357
}
355
358
356
- #[ cfg( any( feature = "std" , test) ) ]
357
- #[ allow( clippy:: std_instead_of_core) ]
358
- impl < Src , Dst : ?Sized > std:: error:: Error for SizeError < Src , Dst >
359
+ #[ cfg( any( zerocopy_core_error, feature = "std" , test) ) ]
360
+ impl < Src , Dst : ?Sized > Error for SizeError < Src , Dst >
359
361
where
360
362
Src : Deref ,
361
363
Dst : KnownLayout ,
@@ -441,9 +443,8 @@ where
441
443
}
442
444
}
443
445
444
- #[ cfg( any( feature = "std" , test) ) ]
445
- #[ allow( clippy:: std_instead_of_core) ]
446
- impl < Src , Dst : ?Sized > std:: error:: Error for ValidityError < Src , Dst >
446
+ #[ cfg( any( zerocopy_core_error, feature = "std" , test) ) ]
447
+ impl < Src , Dst : ?Sized > Error for ValidityError < Src , Dst >
447
448
where
448
449
Src : Deref ,
449
450
Dst : KnownLayout + TryFromBytes ,
0 commit comments