@@ -72,17 +72,20 @@ macro_rules! prelude {
72
72
mod prelude {
73
73
// Exports from `core`
74
74
#[ allow( unused_imports) ]
75
- pub ( crate ) use :: core:: clone:: Clone ;
75
+ pub ( crate ) use core:: clone:: Clone ;
76
76
#[ allow( unused_imports) ]
77
- pub ( crate ) use :: core:: default :: Default ;
77
+ pub ( crate ) use core:: default :: Default ;
78
78
#[ allow( unused_imports) ]
79
- pub ( crate ) use :: core:: marker :: { Copy , Send , Sync } ;
79
+ pub ( crate ) use core:: { fmt , hash , iter , mem , ptr } ;
80
80
#[ allow( unused_imports) ]
81
- pub ( crate ) use :: core:: option :: Option ;
81
+ pub ( crate ) use core:: marker :: { Copy , Send , Sync } ;
82
82
#[ allow( unused_imports) ]
83
- pub ( crate ) use :: core:: prelude:: v1:: derive;
83
+ pub ( crate ) use core:: prelude:: v1:: derive;
84
84
#[ allow( unused_imports) ]
85
- pub ( crate ) use :: core:: { fmt, hash, iter, mem} ;
85
+ pub ( crate ) use core:: option:: Option ;
86
+
87
+ #[ allow( unused_imports) ]
88
+ pub ( crate ) use fmt:: Debug ;
86
89
#[ allow( unused_imports) ]
87
90
pub ( crate ) use mem:: { align_of, align_of_val, size_of, size_of_val} ;
88
91
@@ -120,9 +123,13 @@ macro_rules! s {
120
123
#[ repr( C ) ]
121
124
#[ cfg_attr(
122
125
feature = "extra_traits" ,
123
- :: core:: prelude:: v1:: derive( Debug , Eq , Hash , PartialEq )
126
+ :: core:: prelude:: v1:: derive( Eq , Hash , PartialEq )
127
+ ) ]
128
+ #[ :: core:: prelude:: v1:: derive(
129
+ :: core:: clone:: Clone ,
130
+ :: core:: marker:: Copy ,
131
+ :: core:: fmt:: Debug ,
124
132
) ]
125
- #[ :: core:: prelude:: v1:: derive( :: core:: clone:: Clone , :: core:: marker:: Copy ) ]
126
133
#[ allow( deprecated) ]
127
134
$( #[ $attr] ) *
128
135
pub struct $i { $( $field) * }
@@ -142,17 +149,21 @@ macro_rules! s_paren {
142
149
__item! {
143
150
#[ cfg_attr(
144
151
feature = "extra_traits" ,
145
- :: core:: prelude:: v1:: derive( Debug , Eq , Hash , PartialEq )
152
+ :: core:: prelude:: v1:: derive( Eq , Hash , PartialEq )
153
+ ) ]
154
+ #[ :: core:: prelude:: v1:: derive(
155
+ :: core:: clone:: Clone ,
156
+ :: core:: marker:: Copy ,
157
+ :: core:: fmt:: Debug ,
146
158
) ]
147
- #[ :: core:: prelude:: v1:: derive( :: core:: clone:: Clone , :: core:: marker:: Copy ) ]
148
159
$( #[ $attr] ) *
149
160
pub struct $i ( $( $field) * ) ;
150
161
}
151
162
) * ) ;
152
163
}
153
164
154
- /// Implement `Clone` and `Copy` for a struct with no `extra_traits` feature, as well as `Debug`
155
- /// with `extra_traits` since that can always be derived .
165
+ /// Implement `Clone`, `Copy`, and `Debug` since those can be derived, but exclude `PartialEq`,
166
+ /// `Eq`, and `Hash` .
156
167
///
157
168
/// Most items will prefer to use [`s`].
158
169
macro_rules! s_no_extra_traits {
@@ -171,7 +182,6 @@ macro_rules! s_no_extra_traits {
171
182
pub union $i { $( $field) * }
172
183
}
173
184
174
- #[ cfg( feature = "extra_traits" ) ]
175
185
impl :: core:: fmt:: Debug for $i {
176
186
fn fmt( & self , f: & mut :: core:: fmt:: Formatter <' _>) -> :: core:: fmt:: Result {
177
187
f. debug_struct( :: core:: stringify!( $i) ) . finish_non_exhaustive( )
@@ -182,8 +192,11 @@ macro_rules! s_no_extra_traits {
182
192
( it: $( #[ $attr: meta] ) * pub struct $i: ident { $( $field: tt) * } ) => (
183
193
__item! {
184
194
#[ repr( C ) ]
185
- #[ :: core:: prelude:: v1:: derive( :: core:: clone:: Clone , :: core:: marker:: Copy ) ]
186
- #[ cfg_attr( feature = "extra_traits" , :: core:: prelude:: v1:: derive( Debug ) ) ]
195
+ #[ :: core:: prelude:: v1:: derive(
196
+ :: core:: clone:: Clone ,
197
+ :: core:: marker:: Copy ,
198
+ :: core:: fmt:: Debug ,
199
+ ) ]
187
200
$( #[ $attr] ) *
188
201
pub struct $i { $( $field) * }
189
202
}
0 commit comments