@@ -179,9 +179,13 @@ where
179179 }
180180}
181181
182- #[ cfg( all ( any ( feature = "std" , feature = "alloc" ) , not( no_relaxed_trait_bounds) ) ) ]
182+ #[ cfg( not( no_relaxed_trait_bounds) ) ]
183183macro_rules! seq_impl {
184- ( $ty: ident <T $( : $tbound1: ident $( + $tbound2: ident) * ) * $( , $typaram: ident : $bound: ident) * >) => {
184+ (
185+ $( #[ $attr: meta] ) *
186+ $ty: ident <T $( : $tbound1: ident $( + $tbound2: ident) * ) * $( , $typaram: ident : $bound: ident) * >
187+ ) => {
188+ $( #[ $attr] ) *
185189 impl <T $( , $typaram) * > Serialize for $ty<T $( , $typaram) * >
186190 where
187191 T : Serialize ,
@@ -197,9 +201,13 @@ macro_rules! seq_impl {
197201 }
198202}
199203
200- #[ cfg( all ( any ( feature = "std" , feature = "alloc" ) , no_relaxed_trait_bounds) ) ]
204+ #[ cfg( no_relaxed_trait_bounds) ]
201205macro_rules! seq_impl {
202- ( $ty: ident <T $( : $tbound1: ident $( + $tbound2: ident) * ) * $( , $typaram: ident : $bound: ident) * >) => {
206+ (
207+ $( #[ $attr: meta] ) *
208+ $ty: ident <T $( : $tbound1: ident $( + $tbound2: ident) * ) * $( , $typaram: ident : $bound: ident) * >
209+ ) => {
210+ $( #[ $attr] ) *
203211 impl <T $( , $typaram) * > Serialize for $ty<T $( , $typaram) * >
204212 where
205213 T : Serialize $( + $tbound1 $( + $tbound2) * ) * ,
@@ -216,23 +224,35 @@ macro_rules! seq_impl {
216224 }
217225}
218226
219- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
220- seq_impl ! ( BinaryHeap <T : Ord >) ;
227+ seq_impl ! {
228+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
229+ BinaryHeap <T : Ord >
230+ }
221231
222- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
223- seq_impl ! ( BTreeSet <T : Ord >) ;
232+ seq_impl ! {
233+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
234+ BTreeSet <T : Ord >
235+ }
224236
225- #[ cfg( feature = "std" ) ]
226- seq_impl ! ( HashSet <T : Eq + Hash , H : BuildHasher >) ;
237+ seq_impl ! {
238+ #[ cfg( feature = "std" ) ]
239+ HashSet <T : Eq + Hash , H : BuildHasher >
240+ }
227241
228- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
229- seq_impl ! ( LinkedList <T >) ;
242+ seq_impl ! {
243+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
244+ LinkedList <T >
245+ }
230246
231- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
232- seq_impl ! ( Vec <T >) ;
247+ seq_impl ! {
248+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
249+ Vec <T >
250+ }
233251
234- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
235- seq_impl ! ( VecDeque <T >) ;
252+ seq_impl ! {
253+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
254+ VecDeque <T >
255+ }
236256
237257////////////////////////////////////////////////////////////////////////////////
238258
@@ -394,9 +414,13 @@ tuple_impls! {
394414
395415////////////////////////////////////////////////////////////////////////////////
396416
397- #[ cfg( all ( any ( feature = "std" , feature = "alloc" ) , not( no_relaxed_trait_bounds) ) ) ]
417+ #[ cfg( not( no_relaxed_trait_bounds) ) ]
398418macro_rules! map_impl {
399- ( $ty: ident <K $( : $kbound1: ident $( + $kbound2: ident) * ) * , V $( , $typaram: ident : $bound: ident) * >) => {
419+ (
420+ $( #[ $attr: meta] ) *
421+ $ty: ident <K $( : $kbound1: ident $( + $kbound2: ident) * ) * , V $( , $typaram: ident : $bound: ident) * >
422+ ) => {
423+ $( #[ $attr] ) *
400424 impl <K , V $( , $typaram) * > Serialize for $ty<K , V $( , $typaram) * >
401425 where
402426 K : Serialize ,
@@ -413,9 +437,13 @@ macro_rules! map_impl {
413437 }
414438}
415439
416- #[ cfg( all ( any ( feature = "std" , feature = "alloc" ) , no_relaxed_trait_bounds) ) ]
440+ #[ cfg( no_relaxed_trait_bounds) ]
417441macro_rules! map_impl {
418- ( $ty: ident <K $( : $kbound1: ident $( + $kbound2: ident) * ) * , V $( , $typaram: ident : $bound: ident) * >) => {
442+ (
443+ $( #[ $attr: meta] ) *
444+ $ty: ident <K $( : $kbound1: ident $( + $kbound2: ident) * ) * , V $( , $typaram: ident : $bound: ident) * >
445+ ) => {
446+ $( #[ $attr] ) *
419447 impl <K , V $( , $typaram) * > Serialize for $ty<K , V $( , $typaram) * >
420448 where
421449 K : Serialize $( + $kbound1 $( + $kbound2) * ) * ,
@@ -433,11 +461,15 @@ macro_rules! map_impl {
433461 }
434462}
435463
436- #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
437- map_impl ! ( BTreeMap <K : Ord , V >) ;
464+ map_impl ! {
465+ #[ cfg( any( feature = "std" , feature = "alloc" ) ) ]
466+ BTreeMap <K : Ord , V >
467+ }
438468
439- #[ cfg( feature = "std" ) ]
440- map_impl ! ( HashMap <K : Eq + Hash , V , H : BuildHasher >) ;
469+ map_impl ! {
470+ #[ cfg( feature = "std" ) ]
471+ HashMap <K : Eq + Hash , V , H : BuildHasher >
472+ }
441473
442474////////////////////////////////////////////////////////////////////////////////
443475
0 commit comments