File tree 2 files changed +7
-12
lines changed
2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -153,14 +153,9 @@ fn create_derive_meta(path: Path) -> Meta {
153
153
154
154
fn contains_nested_soa ( attrs : & [ Attribute ] ) -> bool {
155
155
for attr in attrs {
156
- if let Ok ( meta) = attr. parse_meta ( ) {
157
- match meta {
158
- Meta :: Path ( path) => {
159
- if path. is_ident ( "nested_soa" ) {
160
- return true ;
161
- }
162
- }
163
- _ => ( ) ,
156
+ if let Ok ( Meta :: Path ( path) ) = attr. parse_meta ( ) {
157
+ if path. is_ident ( "nested_soa" ) {
158
+ return true ;
164
159
}
165
160
}
166
161
}
Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ pub fn derive(input: &Input) -> TokenStream {
28
28
. map ( |field| & field. ty )
29
29
. collect :: < Vec < _ > > ( ) ;
30
30
let first_field_type = & fields_types[ 0 ] ;
31
- let first_nested = input. nested_fields . iter ( ) . find ( |field|
31
+ let first_nested = input. nested_fields . iter ( ) . any ( |field|
32
32
{
33
33
field. ident . as_ref ( ) . unwrap ( ) == first_field
34
34
}
35
- ) . is_some ( ) ;
35
+ ) ;
36
36
37
37
let mut iter_type = if first_nested {
38
38
quote ! {
@@ -94,11 +94,11 @@ pub fn derive(input: &Input) -> TokenStream {
94
94
for field in & input. fields [ 1 ..] {
95
95
let field_name = & field. ident ;
96
96
let field_type = & field. ty ;
97
- let nested = input. nested_fields . iter ( ) . find ( |field|
97
+ let nested = input. nested_fields . iter ( ) . any ( |field|
98
98
{
99
99
field. ident . as_ref ( ) . unwrap ( ) == field_name. as_ref ( ) . unwrap ( )
100
100
}
101
- ) . is_some ( ) ;
101
+ ) ;
102
102
iter_pat = quote ! {
103
103
( #iter_pat, #field_name)
104
104
} ;
You can’t perform that action at this time.
0 commit comments