@@ -1186,7 +1186,11 @@ impl<'tcx> TyCtxt<'tcx> {
1186
1186
} ;
1187
1187
debug ! ( "layout_scalar_valid_range: attr={:?}" , attr) ;
1188
1188
if let Some (
1189
- & [ ast:: NestedMetaItem :: Literal ( ast:: Lit { kind : ast:: LitKind :: Int ( a, _) , .. } ) ] ,
1189
+ & [
1190
+ ast:: NestedMetaItem :: Literal ( ast:: Lit {
1191
+ kind : ast:: LitKind :: Int ( a, _) , ..
1192
+ } ) ,
1193
+ ] ,
1190
1194
) = attr. meta_item_list ( ) . as_deref ( )
1191
1195
{
1192
1196
Bound :: Included ( a)
@@ -1659,7 +1663,7 @@ macro_rules! nop_lift {
1659
1663
impl <' a, ' tcx> Lift <' tcx> for $ty {
1660
1664
type Lifted = $lifted;
1661
1665
fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1662
- if tcx. interners. $set. contains_pointer_to( & InternedInSet ( & * self . 0 . 0 ) ) {
1666
+ if tcx. interners. $set. contains_pointer_to( & InternedInSet ( & * self . 0.0 ) ) {
1663
1667
// SAFETY: `self` is interned and therefore valid
1664
1668
// for the entire lifetime of the `TyCtxt`.
1665
1669
Some ( unsafe { mem:: transmute( self ) } )
@@ -2244,11 +2248,7 @@ impl<'tcx> TyCtxt<'tcx> {
2244
2248
/// `*r == kind`.
2245
2249
#[ inline]
2246
2250
pub fn reuse_or_mk_region ( self , r : Region < ' tcx > , kind : RegionKind ) -> Region < ' tcx > {
2247
- if * r == kind {
2248
- r
2249
- } else {
2250
- self . mk_region ( kind)
2251
- }
2251
+ if * r == kind { r } else { self . mk_region ( kind) }
2252
2252
}
2253
2253
2254
2254
#[ allow( rustc:: usage_of_ty_tykind) ]
@@ -2268,11 +2268,7 @@ impl<'tcx> TyCtxt<'tcx> {
2268
2268
pred : Predicate < ' tcx > ,
2269
2269
binder : Binder < ' tcx , PredicateKind < ' tcx > > ,
2270
2270
) -> Predicate < ' tcx > {
2271
- if pred. kind ( ) != binder {
2272
- self . mk_predicate ( binder)
2273
- } else {
2274
- pred
2275
- }
2271
+ if pred. kind ( ) != binder { self . mk_predicate ( binder) } else { pred }
2276
2272
}
2277
2273
2278
2274
pub fn mk_mach_int ( self , tm : IntTy ) -> Ty < ' tcx > {
@@ -2417,11 +2413,7 @@ impl<'tcx> TyCtxt<'tcx> {
2417
2413
2418
2414
#[ inline]
2419
2415
pub fn mk_diverging_default ( self ) -> Ty < ' tcx > {
2420
- if self . features ( ) . never_type_fallback {
2421
- self . types . never
2422
- } else {
2423
- self . types . unit
2424
- }
2416
+ if self . features ( ) . never_type_fallback { self . types . never } else { self . types . unit }
2425
2417
}
2426
2418
2427
2419
#[ inline]
@@ -2572,9 +2564,11 @@ impl<'tcx> TyCtxt<'tcx> {
2572
2564
eps : & [ ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > ] ,
2573
2565
) -> & ' tcx List < ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > > {
2574
2566
assert ! ( !eps. is_empty( ) ) ;
2575
- assert ! ( eps
2576
- . array_windows( )
2577
- . all( |[ a, b] | a. skip_binder( ) . stable_cmp( self , & b. skip_binder( ) ) != Ordering :: Greater ) ) ;
2567
+ assert ! (
2568
+ eps. array_windows( )
2569
+ . all( |[ a, b] | a. skip_binder( ) . stable_cmp( self , & b. skip_binder( ) )
2570
+ != Ordering :: Greater )
2571
+ ) ;
2578
2572
self . _intern_poly_existential_predicates ( eps)
2579
2573
}
2580
2574
@@ -2607,49 +2601,29 @@ impl<'tcx> TyCtxt<'tcx> {
2607
2601
}
2608
2602
2609
2603
pub fn intern_substs ( self , ts : & [ GenericArg < ' tcx > ] ) -> & ' tcx List < GenericArg < ' tcx > > {
2610
- if ts. is_empty ( ) {
2611
- List :: empty ( )
2612
- } else {
2613
- self . _intern_substs ( ts)
2614
- }
2604
+ if ts. is_empty ( ) { List :: empty ( ) } else { self . _intern_substs ( ts) }
2615
2605
}
2616
2606
2617
2607
pub fn intern_projs ( self , ps : & [ ProjectionKind ] ) -> & ' tcx List < ProjectionKind > {
2618
- if ps. is_empty ( ) {
2619
- List :: empty ( )
2620
- } else {
2621
- self . _intern_projs ( ps)
2622
- }
2608
+ if ps. is_empty ( ) { List :: empty ( ) } else { self . _intern_projs ( ps) }
2623
2609
}
2624
2610
2625
2611
pub fn intern_place_elems ( self , ts : & [ PlaceElem < ' tcx > ] ) -> & ' tcx List < PlaceElem < ' tcx > > {
2626
- if ts. is_empty ( ) {
2627
- List :: empty ( )
2628
- } else {
2629
- self . _intern_place_elems ( ts)
2630
- }
2612
+ if ts. is_empty ( ) { List :: empty ( ) } else { self . _intern_place_elems ( ts) }
2631
2613
}
2632
2614
2633
2615
pub fn intern_canonical_var_infos (
2634
2616
self ,
2635
2617
ts : & [ CanonicalVarInfo < ' tcx > ] ,
2636
2618
) -> CanonicalVarInfos < ' tcx > {
2637
- if ts. is_empty ( ) {
2638
- List :: empty ( )
2639
- } else {
2640
- self . _intern_canonical_var_infos ( ts)
2641
- }
2619
+ if ts. is_empty ( ) { List :: empty ( ) } else { self . _intern_canonical_var_infos ( ts) }
2642
2620
}
2643
2621
2644
2622
pub fn intern_bound_variable_kinds (
2645
2623
self ,
2646
2624
ts : & [ ty:: BoundVariableKind ] ,
2647
2625
) -> & ' tcx List < ty:: BoundVariableKind > {
2648
- if ts. is_empty ( ) {
2649
- List :: empty ( )
2650
- } else {
2651
- self . _intern_bound_variable_kinds ( ts)
2652
- }
2626
+ if ts. is_empty ( ) { List :: empty ( ) } else { self . _intern_bound_variable_kinds ( ts) }
2653
2627
}
2654
2628
2655
2629
pub fn mk_fn_sig < I > (
0 commit comments