@@ -208,10 +208,10 @@ pub fn get_real_types(
208
208
if !adds. is_empty ( ) {
209
209
res. extend ( adds) ;
210
210
} else if !ty. is_full_generic ( ) {
211
- if let Some ( did ) = ty . def_id ( ) {
212
- if let Some ( kind ) = cx. tcx . def_kind ( did) . clean ( cx) {
213
- res . insert ( ( ty , kind ) ) ;
214
- }
211
+ if let Some ( kind ) =
212
+ ty . def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) )
213
+ {
214
+ res . insert ( ( ty , kind ) ) ;
215
215
}
216
216
}
217
217
}
@@ -226,20 +226,18 @@ pub fn get_real_types(
226
226
if !adds. is_empty ( ) {
227
227
res. extend ( adds) ;
228
228
} else if !ty. is_full_generic ( ) {
229
- if let Some ( did ) = ty . def_id ( ) {
230
- if let Some ( kind ) = cx. tcx . def_kind ( did) . clean ( cx) {
231
- res . insert ( ( ty . clone ( ) , kind ) ) ;
232
- }
229
+ if let Some ( kind ) =
230
+ ty . def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) )
231
+ {
232
+ res . insert ( ( ty . clone ( ) , kind ) ) ;
233
233
}
234
234
}
235
235
}
236
236
}
237
237
}
238
238
} else {
239
- if let Some ( did) = arg. def_id ( ) {
240
- if let Some ( kind) = cx. tcx . def_kind ( did) . clean ( cx) {
241
- res. insert ( ( arg. clone ( ) , kind) ) ;
242
- }
239
+ if let Some ( kind) = arg. def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) ) {
240
+ res. insert ( ( arg. clone ( ) , kind) ) ;
243
241
}
244
242
if let Some ( gens) = arg. generics ( ) {
245
243
for gen in gens. iter ( ) {
@@ -248,10 +246,10 @@ pub fn get_real_types(
248
246
if !adds. is_empty ( ) {
249
247
res. extend ( adds) ;
250
248
}
251
- } else if let Some ( did ) = gen . def_id ( ) {
252
- if let Some ( kind ) = cx. tcx . def_kind ( did) . clean ( cx) {
253
- res . insert ( ( gen . clone ( ) , kind ) ) ;
254
- }
249
+ } else if let Some ( kind ) =
250
+ gen . def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) )
251
+ {
252
+ res . insert ( ( gen . clone ( ) , kind ) ) ;
255
253
}
256
254
}
257
255
}
@@ -277,10 +275,8 @@ pub fn get_all_types(
277
275
if !args. is_empty ( ) {
278
276
all_types. extend ( args) ;
279
277
} else {
280
- if let Some ( did) = arg. type_ . def_id ( ) {
281
- if let Some ( kind) = cx. tcx . def_kind ( did) . clean ( cx) {
282
- all_types. insert ( ( arg. type_ . clone ( ) , kind) ) ;
283
- }
278
+ if let Some ( kind) = arg. type_ . def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) ) {
279
+ all_types. insert ( ( arg. type_ . clone ( ) , kind) ) ;
284
280
}
285
281
}
286
282
}
@@ -289,10 +285,10 @@ pub fn get_all_types(
289
285
FnRetTy :: Return ( ref return_type) => {
290
286
let mut ret = get_real_types ( generics, & return_type, cx, 0 ) ;
291
287
if ret. is_empty ( ) {
292
- if let Some ( did ) = return_type . def_id ( ) {
293
- if let Some ( kind ) = cx. tcx . def_kind ( did) . clean ( cx) {
294
- ret . insert ( ( return_type . clone ( ) , kind ) ) ;
295
- }
288
+ if let Some ( kind ) =
289
+ return_type . def_id ( ) . and_then ( |did| cx. tcx . def_kind ( did) . clean ( cx) )
290
+ {
291
+ ret . insert ( ( return_type . clone ( ) , kind ) ) ;
296
292
}
297
293
}
298
294
ret. into_iter ( ) . collect ( )
0 commit comments