Clean up unused cx parameters
This commit is contained in:
parent
3c93a95b1f
commit
2156f6733e
2 changed files with 5 additions and 5 deletions
|
@ -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 {
|
||||
|
|
|
@ -950,8 +950,8 @@ pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<I
|
|||
|
||||
/// Checks if a given expression is a match expression expanded from the `?`
|
||||
/// operator or the `try` macro.
|
||||
pub fn is_try<'a>(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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue