@@ -17,12 +17,12 @@ pub struct Input {
17
17
/// Additional attributes requested with `#[soa_attr(...)]` or
18
18
/// `#[soa_derive()]`
19
19
pub attrs : ExtraAttributes ,
20
- }
21
20
22
- pub struct ExtraAttributes {
23
21
// did the user explicitly asked us to derive clone?
24
22
pub derive_clone : bool ,
23
+ }
25
24
25
+ pub struct ExtraAttributes {
26
26
pub vec : Vec < Meta > ,
27
27
pub slice : Vec < Meta > ,
28
28
pub slice_mut : Vec < Meta > ,
@@ -35,7 +35,6 @@ pub struct ExtraAttributes {
35
35
impl ExtraAttributes {
36
36
fn new ( ) -> ExtraAttributes {
37
37
ExtraAttributes {
38
- derive_clone : false ,
39
38
vec : Vec :: new ( ) ,
40
39
slice : Vec :: new ( ) ,
41
40
slice_mut : Vec :: new ( ) ,
@@ -130,9 +129,6 @@ impl ExtraAttributes {
130
129
// always add this derive to the Vec struct
131
130
self . vec . push ( derive) ;
132
131
133
- if path. is_ident ( "Clone" ) {
134
- self . derive_clone = true ;
135
- }
136
132
}
137
133
}
138
134
@@ -160,6 +156,7 @@ impl Input {
160
156
161
157
let mut extra_attrs = ExtraAttributes :: new ( ) ;
162
158
159
+ let mut derive_clone = false ;
163
160
for attr in input. attrs {
164
161
if let Ok ( meta) = attr. parse_meta ( ) {
165
162
if meta. path ( ) . is_ident ( "soa_derive" ) {
@@ -173,6 +170,9 @@ impl Input {
173
170
panic ! ( "can not derive Copy for SoA vectors" ) ;
174
171
}
175
172
extra_attrs. add_derive ( path) ;
173
+ if path. is_ident ( "Clone" ) {
174
+ derive_clone = true ;
175
+ }
176
176
}
177
177
NestedMeta :: Lit ( _) => {
178
178
panic ! (
@@ -200,6 +200,7 @@ impl Input {
200
200
fields : fields,
201
201
visibility : input. vis ,
202
202
attrs : extra_attrs,
203
+ derive_clone,
203
204
}
204
205
}
205
206
0 commit comments