@@ -62,58 +62,54 @@ impl IntPlusOne {
6262 fn check_binop ( cx : & EarlyContext < ' _ > , binop : BinOpKind , lhs : & Expr , rhs : & Expr ) -> Option < String > {
6363 match ( binop, & lhs. kind , & rhs. kind ) {
6464 // case where `x - 1 >= ...` or `-1 + x >= ...`
65- ( BinOpKind :: Ge , & ExprKind :: Binary ( ref lhskind, ref lhslhs, ref lhsrhs) , _) => {
65+ ( BinOpKind :: Ge , ExprKind :: Binary ( lhskind, lhslhs, lhsrhs) , _) => {
6666 match ( lhskind. node , & lhslhs. kind , & lhsrhs. kind ) {
6767 // `-1 + x`
68- ( BinOpKind :: Add , & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, -1 ) => {
68+ ( BinOpKind :: Add , ExprKind :: Lit ( lit) , _) if Self :: check_lit ( lit, -1 ) => {
6969 Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: Lhs )
7070 } ,
7171 // `x - 1`
72- ( BinOpKind :: Sub , _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
72+ ( BinOpKind :: Sub , _, ExprKind :: Lit ( lit) ) if Self :: check_lit ( lit, 1 ) => {
7373 Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: Lhs )
7474 } ,
7575 _ => None ,
7676 }
7777 } ,
7878 // case where `... >= y + 1` or `... >= 1 + y`
79- ( BinOpKind :: Ge , _, & ExprKind :: Binary ( ref rhskind, ref rhslhs, ref rhsrhs) )
80- if rhskind. node == BinOpKind :: Add =>
81- {
79+ ( BinOpKind :: Ge , _, ExprKind :: Binary ( rhskind, rhslhs, rhsrhs) ) if rhskind. node == BinOpKind :: Add => {
8280 match ( & rhslhs. kind , & rhsrhs. kind ) {
8381 // `y + 1` and `1 + y`
84- ( & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, 1 ) => {
82+ ( ExprKind :: Lit ( lit) , _) if Self :: check_lit ( lit, 1 ) => {
8583 Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: Rhs )
8684 } ,
87- ( _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
85+ ( _, ExprKind :: Lit ( lit) ) if Self :: check_lit ( lit, 1 ) => {
8886 Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: Rhs )
8987 } ,
9088 _ => None ,
9189 }
9290 } ,
9391 // case where `x + 1 <= ...` or `1 + x <= ...`
94- ( BinOpKind :: Le , & ExprKind :: Binary ( ref lhskind, ref lhslhs, ref lhsrhs) , _)
95- if lhskind. node == BinOpKind :: Add =>
96- {
92+ ( BinOpKind :: Le , ExprKind :: Binary ( lhskind, lhslhs, lhsrhs) , _) if lhskind. node == BinOpKind :: Add => {
9793 match ( & lhslhs. kind , & lhsrhs. kind ) {
9894 // `1 + x` and `x + 1`
99- ( & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, 1 ) => {
95+ ( ExprKind :: Lit ( lit) , _) if Self :: check_lit ( lit, 1 ) => {
10096 Self :: generate_recommendation ( cx, binop, lhsrhs, rhs, Side :: Lhs )
10197 } ,
102- ( _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
98+ ( _, ExprKind :: Lit ( lit) ) if Self :: check_lit ( lit, 1 ) => {
10399 Self :: generate_recommendation ( cx, binop, lhslhs, rhs, Side :: Lhs )
104100 } ,
105101 _ => None ,
106102 }
107103 } ,
108104 // case where `... >= y - 1` or `... >= -1 + y`
109- ( BinOpKind :: Le , _, & ExprKind :: Binary ( ref rhskind, ref rhslhs, ref rhsrhs) ) => {
105+ ( BinOpKind :: Le , _, ExprKind :: Binary ( rhskind, rhslhs, rhsrhs) ) => {
110106 match ( rhskind. node , & rhslhs. kind , & rhsrhs. kind ) {
111107 // `-1 + y`
112- ( BinOpKind :: Add , & ExprKind :: Lit ( ref lit) , _) if Self :: check_lit ( lit, -1 ) => {
108+ ( BinOpKind :: Add , ExprKind :: Lit ( lit) , _) if Self :: check_lit ( lit, -1 ) => {
113109 Self :: generate_recommendation ( cx, binop, rhsrhs, lhs, Side :: Rhs )
114110 } ,
115111 // `y - 1`
116- ( BinOpKind :: Sub , _, & ExprKind :: Lit ( ref lit) ) if Self :: check_lit ( lit, 1 ) => {
112+ ( BinOpKind :: Sub , _, ExprKind :: Lit ( lit) ) if Self :: check_lit ( lit, 1 ) => {
117113 Self :: generate_recommendation ( cx, binop, rhslhs, lhs, Side :: Rhs )
118114 } ,
119115 _ => None ,
0 commit comments