mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
Formatting inside if_chain! macro
This commit is contained in:
parent
f32c2fcb7e
commit
42d849c185
1 changed files with 10 additions and 3 deletions
|
@ -60,8 +60,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for GetLastWithLen {
|
|||
|
||||
// Argument to "get" is a subtraction
|
||||
if let Some(get_index_arg) = args.get(1);
|
||||
if let ExprKind::Binary(Spanned{node: BinOpKind::Sub, ..},
|
||||
lhs, rhs) = &get_index_arg.node;
|
||||
if let ExprKind::Binary(
|
||||
Spanned {
|
||||
node: BinOpKind::Sub,
|
||||
..
|
||||
},
|
||||
lhs,
|
||||
rhs,
|
||||
) = &get_index_arg.node;
|
||||
|
||||
// LHS of subtraction is "x.len()"
|
||||
if let ExprKind::MethodCall(arg_lhs_path, _, lhs_args) = &lhs.node;
|
||||
|
@ -91,7 +97,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for GetLastWithLen {
|
|||
&format!("accessing last element with `{0}.get({0}.len() - 1)`", vec_name),
|
||||
"try",
|
||||
format!("{}.last()", vec_name),
|
||||
applicability);
|
||||
applicability,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue