@@ -88,7 +88,10 @@ fn is_result_ok(cx: &LateContext<'_, '_>, expr: &'_ Expr<'_>) -> bool {
88
88
/// this function returns Some(Option<_> tested against, the method to call on
89
89
/// the object (map_or or map_or_else), expression if Option is Some,
90
90
/// expression if Option is None). Otherwise, it returns None.
91
- fn detect_option_if_let_else < ' a > ( cx : & LateContext < ' _ , ' _ > , expr : & ' a Expr < ' _ > ) -> Option < ( String , String , String , String ) > {
91
+ fn detect_option_if_let_else < ' a > (
92
+ cx : & LateContext < ' _ , ' _ > ,
93
+ expr : & ' a Expr < ' _ > ,
94
+ ) -> Option < ( String , String , String , String ) > {
92
95
if_chain ! {
93
96
if let ExprKind :: Match ( let_body, arms, MatchSource :: IfLetDesugar { contains_else_clause: true } ) = & expr. kind;
94
97
if arms. len( ) == 2 ;
@@ -102,7 +105,8 @@ fn detect_option_if_let_else<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr<'_>) -
102
105
} else {
103
106
( arms[ 1 ] . body, arms[ 0 ] . body)
104
107
} ;
105
- let some_body = if let ExprKind :: Block ( Block { stmts: statements, expr: Some ( expr) , .. } , _) = & some_body. kind {
108
+ let some_body = if let ExprKind :: Block ( Block { stmts: statements, expr: Some ( expr) , .. } , _)
109
+ = & some_body. kind {
106
110
if let & [ ] = & statements {
107
111
expr
108
112
} else {
@@ -122,7 +126,8 @@ fn detect_option_if_let_else<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr<'_>) -
122
126
} else {
123
127
return None ;
124
128
} ;
125
- let ( none_body, method_sugg) = if let ExprKind :: Block ( Block { stmts: statements, expr: Some ( expr) , .. } , _) = & none_body. kind {
129
+ let ( none_body, method_sugg) = if let ExprKind :: Block ( Block { stmts: statements, expr: Some ( expr) , .. } , _)
130
+ = & none_body. kind {
126
131
if let & [ ] = & statements {
127
132
( expr, "map_or" )
128
133
} else {
0 commit comments