@@ -63,7 +63,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitSaturatingSub {
63
63
64
64
// Check if assign operation is done
65
65
if let StmtKind :: Semi ( ref e) = block. stmts[ 0 ] . kind;
66
- if let ( true , Some ( target) ) = subtracts_one( cx, e) ;
66
+ if let Some ( target) = subtracts_one( cx, e) ;
67
67
68
68
// Extracting out the variable name
69
69
if let ExprKind :: Path ( ref assign_path) = target. kind;
@@ -125,7 +125,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitSaturatingSub {
125
125
}
126
126
}
127
127
128
- fn subtracts_one < ' a > ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' a > ) -> ( bool , Option < & ' a Expr < ' a > > ) {
128
+ fn subtracts_one < ' a > ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' a > ) -> Option < & ' a Expr < ' a > > {
129
129
match expr. kind {
130
130
ExprKind :: AssignOp ( ref op1, ref target, ref value) => {
131
131
if_chain ! {
@@ -134,9 +134,9 @@ fn subtracts_one<'a>(cx: &LateContext<'_, '_>, expr: &Expr<'a>) -> (bool, Option
134
134
if let ExprKind :: Lit ( ref lit1) = value. kind;
135
135
if let LitKind :: Int ( 1 , _) = lit1. node;
136
136
then {
137
- ( true , Option :: Some ( target) )
137
+ Some ( target)
138
138
} else {
139
- ( false , None )
139
+ None
140
140
}
141
141
}
142
142
} ,
@@ -150,13 +150,13 @@ fn subtracts_one<'a>(cx: &LateContext<'_, '_>, expr: &Expr<'a>) -> (bool, Option
150
150
if let ExprKind :: Lit ( ref lit1) = right1. kind;
151
151
if let LitKind :: Int ( 1 , _) = lit1. node;
152
152
then {
153
- ( true , Some ( target) )
153
+ Some ( target)
154
154
} else {
155
- ( false , None )
155
+ None
156
156
}
157
157
}
158
158
} ,
159
- _ => ( false , None ) ,
159
+ _ => None ,
160
160
}
161
161
}
162
162
0 commit comments