@@ -131,7 +131,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
131
131
let ident: syn:: Ident = syn:: Ident :: parse_any ( input) ?;
132
132
if ident == "return_ref" {
133
133
if A :: RETURN_REF {
134
- if let Some ( old) = std :: mem :: replace ( & mut options. return_ref , Some ( ident) ) {
134
+ if let Some ( old) = options. return_ref . replace ( ident) {
135
135
return Err ( syn:: Error :: new (
136
136
old. span ( ) ,
137
137
"option `return_ref` provided twice" ,
@@ -145,7 +145,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
145
145
}
146
146
} else if ident == "no_eq" {
147
147
if A :: NO_EQ {
148
- if let Some ( old) = std :: mem :: replace ( & mut options. no_eq , Some ( ident) ) {
148
+ if let Some ( old) = options. no_eq . replace ( ident) {
149
149
return Err ( syn:: Error :: new ( old. span ( ) , "option `no_eq` provided twice" ) ) ;
150
150
}
151
151
} else {
@@ -156,7 +156,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
156
156
}
157
157
} else if ident == "no_debug" {
158
158
if A :: NO_DEBUG {
159
- if let Some ( old) = std :: mem :: replace ( & mut options. no_debug , Some ( ident) ) {
159
+ if let Some ( old) = options. no_debug . replace ( ident) {
160
160
return Err ( syn:: Error :: new (
161
161
old. span ( ) ,
162
162
"option `no_debug` provided twice" ,
@@ -170,7 +170,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
170
170
}
171
171
} else if ident == "no_lifetime" {
172
172
if A :: NO_LIFETIME {
173
- if let Some ( old) = std :: mem :: replace ( & mut options. no_lifetime , Some ( ident) ) {
173
+ if let Some ( old) = options. no_lifetime . replace ( ident) {
174
174
return Err ( syn:: Error :: new (
175
175
old. span ( ) ,
176
176
"option `no_lifetime` provided twice" ,
@@ -184,7 +184,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
184
184
}
185
185
} else if ident == "no_clone" {
186
186
if A :: NO_CLONE {
187
- if let Some ( old) = std :: mem :: replace ( & mut options. no_clone , Some ( ident) ) {
187
+ if let Some ( old) = options. no_clone . replace ( ident) {
188
188
return Err ( syn:: Error :: new (
189
189
old. span ( ) ,
190
190
"option `no_clone` provided twice" ,
@@ -198,7 +198,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
198
198
}
199
199
} else if ident == "singleton" {
200
200
if A :: SINGLETON {
201
- if let Some ( old) = std :: mem :: replace ( & mut options. singleton , Some ( ident) ) {
201
+ if let Some ( old) = options. singleton . replace ( ident) {
202
202
return Err ( syn:: Error :: new (
203
203
old. span ( ) ,
204
204
"option `singleton` provided twice" ,
@@ -212,7 +212,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
212
212
}
213
213
} else if ident == "specify" {
214
214
if A :: SPECIFY {
215
- if let Some ( old) = std :: mem :: replace ( & mut options. specify , Some ( ident) ) {
215
+ if let Some ( old) = options. specify . replace ( ident) {
216
216
return Err ( syn:: Error :: new (
217
217
old. span ( ) ,
218
218
"option `specify` provided twice" ,
@@ -228,7 +228,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
228
228
if A :: DB {
229
229
let _eq = Equals :: parse ( input) ?;
230
230
let path = syn:: Path :: parse ( input) ?;
231
- if let Some ( old) = std :: mem :: replace ( & mut options. db_path , Some ( path) ) {
231
+ if let Some ( old) = options. db_path . replace ( path) {
232
232
return Err ( syn:: Error :: new ( old. span ( ) , "option `db` provided twice" ) ) ;
233
233
}
234
234
} else {
@@ -241,7 +241,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
241
241
if A :: RECOVERY_FN {
242
242
let _eq = Equals :: parse ( input) ?;
243
243
let path = syn:: Path :: parse ( input) ?;
244
- if let Some ( old) = std :: mem :: replace ( & mut options. recovery_fn , Some ( path) ) {
244
+ if let Some ( old) = options. recovery_fn . replace ( path) {
245
245
return Err ( syn:: Error :: new (
246
246
old. span ( ) ,
247
247
"option `recovery_fn` provided twice" ,
@@ -257,7 +257,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
257
257
if A :: DATA {
258
258
let _eq = Equals :: parse ( input) ?;
259
259
let ident = syn:: Ident :: parse ( input) ?;
260
- if let Some ( old) = std :: mem :: replace ( & mut options. data , Some ( ident) ) {
260
+ if let Some ( old) = options. data . replace ( ident) {
261
261
return Err ( syn:: Error :: new ( old. span ( ) , "option `data` provided twice" ) ) ;
262
262
}
263
263
} else {
@@ -271,7 +271,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
271
271
let _eq = Equals :: parse ( input) ?;
272
272
let lit = syn:: LitInt :: parse ( input) ?;
273
273
let value = lit. base10_parse :: < usize > ( ) ?;
274
- if let Some ( old) = std :: mem :: replace ( & mut options. lru , Some ( value) ) {
274
+ if let Some ( old) = options. lru . replace ( value) {
275
275
return Err ( syn:: Error :: new ( old. span ( ) , "option `lru` provided twice" ) ) ;
276
276
}
277
277
} else {
@@ -284,8 +284,7 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
284
284
if A :: CONSTRUCTOR_NAME {
285
285
let _eq = Equals :: parse ( input) ?;
286
286
let ident = syn:: Ident :: parse ( input) ?;
287
- if let Some ( old) = std:: mem:: replace ( & mut options. constructor_name , Some ( ident) )
288
- {
287
+ if let Some ( old) = options. constructor_name . replace ( ident) {
289
288
return Err ( syn:: Error :: new (
290
289
old. span ( ) ,
291
290
"option `constructor` provided twice" ,
0 commit comments