@@ -38,11 +38,11 @@ declare_lint_pass!(WhileLetSomeResult => [WHILE_LET_SOME_RESULT]);
38
38
39
39
impl < ' tcx > LateLintPass < ' tcx > for WhileLetSomeResult {
40
40
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
41
- if_chain ! { //begin checking variables
42
- if let ExprKind :: Match ( op, body, MatchSource :: WhileLetDesugar { .. } ) = expr. kind; //test if expr is `while let`
43
- if let ExprKind :: MethodCall ( _, ok_span, result_types, _) = op. kind; //check is expr.ok() has type Result<T,E>.ok(, _)
44
- if let PatKind :: TupleStruct ( QPath :: Resolved ( _, x) , y, _) = body[ 0 ] . pat. kind; //get operation
45
- if method_chain_args( op, & [ "ok" ] ) . is_some( ) ; //test to see if using ok() methoduse std::marker::Sized;
41
+ if_chain ! {
42
+ if let ExprKind :: Match ( op, body, MatchSource :: WhileLetDesugar { .. } ) = expr. kind; // test if expr is `while let`
43
+ if let ExprKind :: MethodCall ( _, ok_span, result_types, _) = op. kind;
44
+ if let PatKind :: TupleStruct ( QPath :: Resolved ( _, x) , y, _) = body[ 0 ] . pat. kind; // get operation
45
+ if method_chain_args( op, & [ "ok" ] ) . is_some( ) ; // test to see if using ok() methoduse std::marker::Sized;
46
46
if is_type_diagnostic_item( cx, cx. typeck_results( ) . expr_ty( & result_types[ 0 ] ) , sym:: result_type) ;
47
47
if rustc_hir_pretty:: to_string( rustc_hir_pretty:: NO_ANN , |s| s. print_path( x, false ) ) == "Some" ;
48
48
0 commit comments