@@ -96,17 +96,15 @@ fn adjunct_lines(file: &File, header: &Header, lines: &mut Vec<String>) {
96
96
}
97
97
98
98
fn keyword_lines ( header : & Header , lines : & mut Vec < String > ) {
99
- if header. keywords . len ( ) == 0 {
99
+ if header. keywords . is_empty ( ) {
100
100
lines. push ( " \" keywords\" : []," . to_string ( ) ) ;
101
101
return ;
102
102
}
103
103
104
104
lines. push ( " \" keywords\" : [" . to_string ( ) ) ;
105
105
let last_index = header. keywords . len ( ) - 1 ;
106
106
107
- for i in 0 ..header. keywords . len ( ) {
108
- let keyword = & header. keywords [ i] ;
109
-
107
+ for ( i, keyword) in header. keywords . iter ( ) . enumerate ( ) {
110
108
if i == last_index {
111
109
lines. push ( format ! ( " {{ \" name\" : \" {}\" , \" value\" : \" {}\" }}" , keyword. name, keyword. value) ) ;
112
110
} else {
@@ -126,17 +124,15 @@ fn ext_header_lines(file: &File, header: &Header, lines: &mut Vec<String>) {
126
124
} ,
127
125
} ;
128
126
129
- if keywords. len ( ) == 0 {
127
+ if keywords. is_empty ( ) {
130
128
lines. push ( " \" ext_header\" : []" . to_string ( ) ) ;
131
129
return ;
132
130
}
133
131
134
132
lines. push ( " \" ext_header\" : [" . to_string ( ) ) ;
135
133
let last_index = keywords. len ( ) - 1 ;
136
134
137
- for i in 0 ..keywords. len ( ) {
138
- let keyword = & keywords[ i] ;
139
-
135
+ for ( i, keyword) in keywords. iter ( ) . enumerate ( ) {
140
136
if i == last_index {
141
137
lines. push ( format ! ( " {{ \" name\" : \" {}\" , \" value\" : {}, \" format\" : \" {}\" }}" , keyword. tag, keyword. value, keyword. value. format) ) ;
142
138
} else {
0 commit comments