@@ -1618,7 +1618,7 @@ impl ExplicitOutlivesRequirements {
1618
1618
let mut from_start = true ;
1619
1619
for ( i, bound_span) in bound_spans {
1620
1620
match last_merged_i {
1621
- // If the first bound is inferable, our span should also eat the leading `+`
1621
+ // If the first bound is inferable, our span should also eat the leading `+`.
1622
1622
None if i == 0 => {
1623
1623
merged. push ( bound_span. to ( bounds[ 1 ] . span ( ) . shrink_to_lo ( ) ) ) ;
1624
1624
last_merged_i = Some ( 0 ) ;
@@ -1732,15 +1732,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
1732
1732
hir:: TyKind :: Path ( hir:: QPath :: Resolved (
1733
1733
None ,
1734
1734
ref path,
1735
- ) ) => if let Res :: Def ( DefKind :: TyParam , def_id) = path. res {
1736
- let index = ty_generics. param_def_id_to_index [ & def_id] ;
1737
- (
1738
- Self :: lifetimes_outliving_type ( inferred_outlives, index) ,
1739
- & predicate. bounds ,
1740
- predicate. span ,
1741
- )
1742
- } else {
1743
- continue
1735
+ ) ) => {
1736
+ if let Res :: Def ( DefKind :: TyParam , def_id) = path. res {
1737
+ let index = ty_generics. param_def_id_to_index [ & def_id] ;
1738
+ (
1739
+ Self :: lifetimes_outliving_type ( inferred_outlives, index) ,
1740
+ & predicate. bounds ,
1741
+ predicate. span ,
1742
+ )
1743
+ } else {
1744
+ continue ;
1745
+ }
1744
1746
} ,
1745
1747
_ => { continue ; }
1746
1748
}
@@ -1762,9 +1764,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
1762
1764
}
1763
1765
1764
1766
// If all the bounds on a predicate were inferable and there are
1765
- // further predicates, we want to eat the trailing comma
1767
+ // further predicates, we want to eat the trailing comma.
1766
1768
if drop_predicate && i + 1 < num_predicates {
1767
- let next_predicate_span = hir_generics. where_clause . predicates [ i+ 1 ] . span ( ) ;
1769
+ let next_predicate_span = hir_generics. where_clause . predicates [ i + 1 ] . span ( ) ;
1768
1770
where_lint_spans. push (
1769
1771
span. to ( next_predicate_span. shrink_to_lo ( ) )
1770
1772
) ;
@@ -1787,13 +1789,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
1787
1789
// Extend the where clause back to the closing `>` of the
1788
1790
// generics, except for tuple struct, which have the `where`
1789
1791
// after the fields of the struct.
1790
- let full_where_span = match item. node {
1791
- hir:: ItemKind :: Struct ( hir:: VariantData :: Tuple ( ..) , _) => {
1792
- where_span
1793
- }
1794
- _ => {
1795
- hir_generics. span . shrink_to_hi ( ) . to ( where_span)
1796
- }
1792
+ let full_where_span = if let hir:: ItemKind :: Struct ( hir:: VariantData :: Tuple ( ..) , _)
1793
+ = item. node
1794
+ {
1795
+ where_span
1796
+ } else {
1797
+ hir_generics. span . shrink_to_hi ( ) . to ( where_span)
1797
1798
} ;
1798
1799
lint_spans. push (
1799
1800
full_where_span
0 commit comments