@@ -46,8 +46,8 @@ declare_lint_pass!(IntPlusOne => [INT_PLUS_ONE]);
4646
4747#[ derive( Copy , Clone ) ]
4848enum Side {
49- LHS ,
50- RHS ,
49+ Lhs ,
50+ Rhs ,
5151}
5252
5353impl IntPlusOne {
@@ -66,11 +66,11 @@ impl IntPlusOne {
6666 match ( lhskind. node , & lhslhs. kind , & lhsrhs. kind ) {
6767 // `-1 + x`
6868 ( BinOpKind :: Add , & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, -1 ) => {
69- Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: LHS )
69+ Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: Lhs )
7070 } ,
7171 // `x - 1`
7272 ( BinOpKind :: Sub , _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
73- Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: LHS )
73+ Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: Lhs )
7474 } ,
7575 _ => None ,
7676 }
@@ -82,10 +82,10 @@ impl IntPlusOne {
8282 match ( & rhslhs. kind , & rhsrhs. kind ) {
8383 // `y + 1` and `1 + y`
8484 ( & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, 1 ) => {
85- Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: RHS )
85+ Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: Rhs )
8686 } ,
8787 ( _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
88- Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: RHS )
88+ Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: Rhs )
8989 } ,
9090 _ => None ,
9191 }
@@ -97,10 +97,10 @@ impl IntPlusOne {
9797 match ( & lhslhs. kind , & lhsrhs. kind ) {
9898 // `1 + x` and `x + 1`
9999 ( & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, 1 ) => {
100- Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: LHS )
100+ Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: Lhs )
101101 } ,
102102 ( _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
103- Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: LHS )
103+ Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: Lhs )
104104 } ,
105105 _ => None ,
106106 }
@@ -110,11 +110,11 @@ impl IntPlusOne {
110110 match ( rhskind. node , & rhslhs. kind , & rhsrhs. kind ) {
111111 // `-1 + y`
112112 ( BinOpKind :: Add , & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, -1 ) => {
113- Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: RHS )
113+ Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: Rhs )
114114 } ,
115115 // `y - 1`
116116 ( BinOpKind :: Sub , _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
117- Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: RHS )
117+ Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: Rhs )
118118 } ,
119119 _ => None ,
120120 }
@@ -138,8 +138,8 @@ impl IntPlusOne {
138138 if let Some ( snippet) = snippet_opt ( cx, node. span ) {
139139 if let Some ( other_side_snippet) = snippet_opt ( cx, other_side. span ) {
140140 let rec = match side {
141- Side :: LHS => Some ( format ! ( "{} {} {}" , snippet, binop_string, other_side_snippet) ) ,
142- Side :: RHS => Some ( format ! ( "{} {} {}" , other_side_snippet, binop_string, snippet) ) ,
141+ Side :: Lhs => Some ( format ! ( "{} {} {}" , snippet, binop_string, other_side_snippet) ) ,
142+ Side :: Rhs => Some ( format ! ( "{} {} {}" , other_side_snippet, binop_string, snippet) ) ,
143143 } ;
144144 return rec;
145145 }
0 commit comments