@@ -70,9 +70,9 @@ declare_clippy_lint! {
7070declare_lint_pass ! ( OptionIfLetElse => [ OPTION_IF_LET_ELSE ] ) ;
7171
7272/// Returns true iff the given expression is the result of calling `Result::ok`
73- fn is_result_ok ( cx : & LateContext < ' _ , ' _ > , expr : & ' _ Expr < ' _ > ) -> bool {
73+ fn is_result_ok ( cx : & LateContext < ' _ > , expr : & ' _ Expr < ' _ > ) -> bool {
7474 if let ExprKind :: MethodCall ( ref path, _, & [ ref receiver] , _) = & expr. kind {
75- path. ident . name . to_ident_string ( ) == "ok" && match_type ( cx, & cx. tables . expr_ty ( & receiver) , & paths:: RESULT )
75+ path. ident . name . to_ident_string ( ) == "ok" && match_type ( cx, & cx. tables ( ) . expr_ty ( & receiver) , & paths:: RESULT )
7676 } else {
7777 false
7878 }
@@ -157,7 +157,7 @@ fn extract_body_from_arm<'a>(arm: &'a Arm<'a>) -> Option<&'a Expr<'a>> {
157157
158158/// If this is the else body of an if/else expression, then we need to wrap
159159/// it in curcly braces. Otherwise, we don't.
160- fn should_wrap_in_braces ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' _ > ) -> bool {
160+ fn should_wrap_in_braces ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> bool {
161161 utils:: get_enclosing_block ( cx, expr. hir_id ) . map_or ( false , |parent| {
162162 if let Some ( Expr {
163163 kind :
@@ -181,7 +181,7 @@ fn should_wrap_in_braces(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
181181 } )
182182}
183183
184- fn format_option_in_sugg ( cx : & LateContext < ' _ , ' _ > , cond_expr : & Expr < ' _ > , as_ref : bool , as_mut : bool ) -> String {
184+ fn format_option_in_sugg ( cx : & LateContext < ' _ > , cond_expr : & Expr < ' _ > , as_ref : bool , as_mut : bool ) -> String {
185185 format ! (
186186 "{}{}" ,
187187 Sugg :: hir( cx, cond_expr, ".." ) . maybe_par( ) ,
@@ -198,7 +198,7 @@ fn format_option_in_sugg(cx: &LateContext<'_, '_>, cond_expr: &Expr<'_>, as_ref:
198198/// If this expression is the option if let/else construct we're detecting, then
199199/// this function returns an `OptionIfLetElseOccurence` struct with details if
200200/// this construct is found, or None if this construct is not found.
201- fn detect_option_if_let_else < ' a > ( cx : & LateContext < ' _ , ' a > , expr : & ' a Expr < ' a > ) -> Option < OptionIfLetElseOccurence > {
201+ fn detect_option_if_let_else ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> Option < OptionIfLetElseOccurence > {
202202 if_chain ! {
203203 if !utils:: in_macro( expr. span) ; // Don't lint macros, because it behaves weirdly
204204 if let ExprKind :: Match ( cond_expr, arms, MatchSource :: IfLetDesugar { contains_else_clause: true } ) = & expr. kind;
@@ -242,8 +242,8 @@ fn detect_option_if_let_else<'a>(cx: &LateContext<'_, 'a>, expr: &'a Expr<'a>) -
242242 }
243243}
244244
245- impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for OptionIfLetElse {
246- fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , expr : & ' tcx Expr < ' _ > ) {
245+ impl < ' a > LateLintPass < ' a > for OptionIfLetElse {
246+ fn check_expr ( & mut self , cx : & LateContext < ' a > , expr : & Expr < ' _ > ) {
247247 if let Some ( detection) = detect_option_if_let_else ( cx, expr) {
248248 span_lint_and_sugg (
249249 cx,
0 commit comments