From 2156f6733e9bee83be265d35447bb25091d7e9b2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 14 Apr 2019 13:19:33 -0700 Subject: [PATCH] Clean up unused cx parameters --- clippy_lints/src/unused_io_amount.rs | 2 +- clippy_lints/src/utils/mod.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index bf31b774bba2..89f6873565a5 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedIoAmount { }; match expr.node { - hir::ExprKind::Match(ref res, _, _) if is_try(cx, expr).is_some() => { + hir::ExprKind::Match(ref res, _, _) if is_try(expr).is_some() => { if let hir::ExprKind::Call(ref func, ref args) = res.node { if let hir::ExprKind::Path(ref path) = func.node { if match_qpath(path, &paths::TRY_INTO_RESULT) && args.len() == 1 { diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index e5ce17cf1927..46aec1fa343f 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -950,8 +950,8 @@ pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator(cx: &'_ LateContext<'_, '_>, expr: &'a Expr) -> Option<&'a Expr> { - fn is_ok(cx: &'_ LateContext<'_, '_>, arm: &Arm) -> bool { +pub fn is_try(expr: &Expr) -> Option<&Expr> { + fn is_ok(arm: &Arm) -> bool { if_chain! { if let PatKind::TupleStruct(ref path, ref pat, None) = arm.pats[0].node; if match_qpath(path, &paths::RESULT_OK[1..]); @@ -984,8 +984,8 @@ pub fn is_try<'a>(cx: &'_ LateContext<'_, '_>, expr: &'a Expr) -> Option<&'a Exp if arms.len() == 2; if arms[0].pats.len() == 1 && arms[0].guard.is_none(); if arms[1].pats.len() == 1 && arms[1].guard.is_none(); - if (is_ok(cx, &arms[0]) && is_err(&arms[1])) || - (is_ok(cx, &arms[1]) && is_err(&arms[0])); + if (is_ok(&arms[0]) && is_err(&arms[1])) || + (is_ok(&arms[1]) && is_err(&arms[0])); then { return Some(expr); }