@@ -208,10 +208,10 @@ pub fn get_real_types(
208208 if !adds. is_empty ( ) {
209209 res. extend ( adds) ;
210210 } 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 ) ) ;
215215 }
216216 }
217217 }
@@ -226,20 +226,18 @@ pub fn get_real_types(
226226 if !adds. is_empty ( ) {
227227 res. extend ( adds) ;
228228 } 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 ) ) ;
233233 }
234234 }
235235 }
236236 }
237237 }
238238 } 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) ) ;
243241 }
244242 if let Some ( gens) = arg. generics ( ) {
245243 for gen in gens. iter ( ) {
@@ -248,10 +246,10 @@ pub fn get_real_types(
248246 if !adds. is_empty ( ) {
249247 res. extend ( adds) ;
250248 }
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 ) ) ;
255253 }
256254 }
257255 }
@@ -277,10 +275,8 @@ pub fn get_all_types(
277275 if !args. is_empty ( ) {
278276 all_types. extend ( args) ;
279277 } 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) ) ;
284280 }
285281 }
286282 }
@@ -289,10 +285,10 @@ pub fn get_all_types(
289285 FnRetTy :: Return ( ref return_type) => {
290286 let mut ret = get_real_types ( generics, & return_type, cx, 0 ) ;
291287 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 ) ) ;
296292 }
297293 }
298294 ret. into_iter ( ) . collect ( )
0 commit comments