@@ -63,7 +63,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitSaturatingSub {
6363
6464 // Check if assign operation is done
6565 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) ;
6767
6868 // Extracting out the variable name
6969 if let ExprKind :: Path ( ref assign_path) = target. kind;
@@ -125,7 +125,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitSaturatingSub {
125125 }
126126}
127127
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 > > {
129129 match expr. kind {
130130 ExprKind :: AssignOp ( ref op1, ref target, ref value) => {
131131 if_chain ! {
@@ -134,9 +134,9 @@ fn subtracts_one<'a>(cx: &LateContext<'_, '_>, expr: &Expr<'a>) -> (bool, Option
134134 if let ExprKind :: Lit ( ref lit1) = value. kind;
135135 if let LitKind :: Int ( 1 , _) = lit1. node;
136136 then {
137- ( true , Option :: Some ( target) )
137+ Some ( target)
138138 } else {
139- ( false , None )
139+ None
140140 }
141141 }
142142 } ,
@@ -150,13 +150,13 @@ fn subtracts_one<'a>(cx: &LateContext<'_, '_>, expr: &Expr<'a>) -> (bool, Option
150150 if let ExprKind :: Lit ( ref lit1) = right1. kind;
151151 if let LitKind :: Int ( 1 , _) = lit1. node;
152152 then {
153- ( true , Some ( target) )
153+ Some ( target)
154154 } else {
155- ( false , None )
155+ None
156156 }
157157 }
158158 } ,
159- _ => ( false , None ) ,
159+ _ => None ,
160160 }
161161}
162162
0 commit comments