Skip to content

Commit 5f30a07

Browse files
committed
fix extract arguments
1 parent f244ec7 commit 5f30a07

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
@@ -446,20 +446,12 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
446446
if args_assert_failed.len() >= 4;
447447
if let ExprKind::Call(_, args) = args_assert_failed[3].kind;
448448
if !args.is_empty();
449-
if let ExprKind::Call(_, args_fmt) = args[0].kind;
450-
if !args_fmt.is_empty();
449+
if let ExprKind::Match(expr_match, _, _ ) = args[0].kind;
450+
if let ExprKind::Match(tup_match, _, _) = expr_match.kind;
451+
if let ExprKind::Tup(tup_args_list) = tup_match.kind;
451452
then {
452-
vec_arg.push(&args_fmt[0]);
453-
if_chain! {
454-
if args_fmt.len() >= 2;
455-
if let ExprKind::AddrOf(_, _, expr_match) = args_fmt[1].kind;
456-
if let ExprKind::Match(tup_match, _, _) = expr_match.kind;
457-
if let ExprKind::Tup(tup_args_list) = tup_match.kind;
458-
then{
459-
for arg in tup_args_list {
460-
vec_arg.push(arg);
461-
}
462-
}
453+
for arg in tup_args_list {
454+
vec_arg.push(arg);
463455
}
464456
}
465457
}

0 commit comments

Comments
 (0)