Skip to content

Commit 88cabf2

Browse files
committed
fix extract arguments
1 parent bf905de commit 88cabf2

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
112112
let arg_span = match fmt_args {
113113
[] => None,
114114
[a] => Some(format!(
115-
"{}",
115+
".., {}",
116116
Sugg::hir_with_applicability(cx, a, "..", &mut applicability)
117117
)),
118118
_ => {
119119
let mut args = format!(
120-
"{}",
120+
".., {}",
121121
Sugg::hir_with_applicability(cx, fmt_args[0], "..", &mut applicability)
122122
);
123123
for el in &fmt_args[1..] {

clippy_utils/src/higher.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,20 +448,12 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
448448
if args_assert_failed.len() >= 4;
449449
if let ExprKind::Call(_, args) = args_assert_failed[3].kind;
450450
if !args.is_empty();
451-
if let ExprKind::Call(_, args_fmt) = args[0].kind;
452-
if !args_fmt.is_empty();
451+
if let ExprKind::Match(expr_match, _, _ ) = args[0].kind;
452+
if let ExprKind::Match(tup_match, _, _) = expr_match.kind;
453+
if let ExprKind::Tup(tup_args_list) = tup_match.kind;
453454
then {
454-
vec_arg.push(&args_fmt[0]);
455-
if_chain! {
456-
if args_fmt.len() >= 2;
457-
if let ExprKind::AddrOf(_, _, expr_match) = args_fmt[1].kind;
458-
if let ExprKind::Match(tup_match, _, _) = expr_match.kind;
459-
if let ExprKind::Tup(tup_args_list) = tup_match.kind;
460-
then{
461-
for arg in tup_args_list {
462-
vec_arg.push(arg);
463-
}
464-
}
455+
for arg in tup_args_list {
456+
vec_arg.push(arg);
465457
}
466458
}
467459
}

0 commit comments

Comments
 (0)