Skip to content

Commit e2e2a0f

Browse files
committed
Clippy fixes
1 parent 6b3ee8f commit e2e2a0f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clippy_lints/src/unnecessary_sort_by.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn mirrored_exprs(
9595
// The two exprs are method calls.
9696
// Check to see that the function is the same and the arguments are mirrored
9797
// This is enough because the receiver of the method is listed in the arguments
98-
(ExprKind::MethodCall(left_segment, _, left_args), ExprKind::MethodCall(right_segment, _, right_args)) => {
98+
(ExprKind::MethodCall(left_segment, _, left_args, _), ExprKind::MethodCall(right_segment, _, right_args, _)) => {
9999
left_segment.ident == right_segment.ident
100100
&& left_args
101101
.iter()
@@ -170,7 +170,7 @@ fn mirrored_exprs(
170170

171171
fn detect_lint(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<LintTrigger> {
172172
if_chain! {
173-
if let ExprKind::MethodCall(name_ident, _, args) = &expr.kind;
173+
if let ExprKind::MethodCall(name_ident, _, args, _) = &expr.kind;
174174
if let name = name_ident.ident.name.to_ident_string();
175175
if name == "sort_by" || name == "sort_unstable_by";
176176
if let [vec, Expr { kind: ExprKind::Closure(_, _, closure_body_id, _, _), .. }] = args;
@@ -180,7 +180,7 @@ fn detect_lint(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<LintTrigger>
180180
Param { pat: Pat { kind: PatKind::Binding(_, _, left_ident, _), .. }, ..},
181181
Param { pat: Pat { kind: PatKind::Binding(_, _, right_ident, _), .. }, .. }
182182
] = &closure_body.params;
183-
if let ExprKind::MethodCall(method_path, _, [ref left_expr, ref right_expr]) = &closure_body.value.kind;
183+
if let ExprKind::MethodCall(method_path, _, [ref left_expr, ref right_expr], _) = &closure_body.value.kind;
184184
if method_path.ident.name.to_ident_string() == "cmp";
185185
then {
186186
let (closure_body, closure_arg, reverse) = if mirrored_exprs(

clippy_lints/src/utils/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
120120
(Array(l), Array(r)) | (Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),
121121
(Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value),
122122
(Call(lc, la), Call(rc, ra)) => eq_expr(lc, rc) && over(la, ra, |l, r| eq_expr(l, r)),
123-
(MethodCall(lc, la), MethodCall(rc, ra)) => eq_path_seg(lc, rc) && over(la, ra, |l, r| eq_expr(l, r)),
123+
(MethodCall(lc, la, _), MethodCall(rc, ra, _)) => eq_path_seg(lc, rc) && over(la, ra, |l, r| eq_expr(l, r)),
124124
(Binary(lo, ll, lr), Binary(ro, rl, rr)) => lo.node == ro.node && eq_expr(ll, rl) && eq_expr(lr, rr),
125125
(Unary(lo, l), Unary(ro, r)) => mem::discriminant(lo) == mem::discriminant(ro) && eq_expr(l, r),
126126
(Lit(l), Lit(r)) => l.kind == r.kind,

clippy_lints/src/vec_resize_to_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ declare_lint_pass!(VecResizeToZero => [VEC_RESIZE_TO_ZERO]);
3131
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VecResizeToZero {
3232
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
3333
if_chain! {
34-
if let hir::ExprKind::MethodCall(path_segment, _, ref args) = expr.kind;
34+
if let hir::ExprKind::MethodCall(path_segment, _, ref args, _) = expr.kind;
3535
if let Some(method_def_id) = cx.tables.type_dependent_def_id(expr.hir_id);
3636
if match_def_path(cx, method_def_id, &paths::VEC_RESIZE) && args.len() == 3;
3737
if let ExprKind::Lit(Spanned { node: LitKind::Int(0, _), .. }) = args[1].kind;

0 commit comments

Comments
 (0)