Skip to content

Commit 4f5743b

Browse files
committed
PR Followups
1 parent fc86396 commit 4f5743b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clippy_lints/src/while_let_some_result.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ declare_lint_pass!(WhileLetSomeResult => [WHILE_LET_SOME_RESULT]);
3838

3939
impl<'tcx> LateLintPass<'tcx> for WhileLetSomeResult {
4040
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;
4646
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&result_types[0]), sym::result_type);
4747
if rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_path(x, false)) == "Some";
4848

0 commit comments

Comments
 (0)