Skip to content

Commit 568425c

Browse files
committed
Start incorporating suggestions
1 parent 3c93abd commit 568425c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clippy_lints/src/use_last.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseLast {
5858
let struct_ty = cx.tables.expr_ty(struct_calling_on);
5959
if match_type(cx, struct_ty, &*paths::VEC);
6060

61-
// Argument to "get" is a binary operation
61+
// Argument to "get" is a subtraction
6262
if let Some(get_index_arg) = args.get(1);
63-
if let rustc::hir::ExprKind::Binary(ref op, ref lhs, ref rhs) = get_index_arg.node;
64-
65-
// Binary operation is a subtraction
66-
if op.node == rustc::hir::BinOpKind::Sub;
63+
if let ExprKind::Binary(Spanned{node: BinOpKind::Sub, span: _},
64+
ref lhs, ref rhs) = get_index_arg.node;
6765

6866
// LHS of subtraction is "x.len()"
6967
if let ExprKind::MethodCall(ref arg_lhs_path, _, ref lhs_args) = lhs.node;
70-
if arg_lhs_path.ident.name == "len";
68+
if arg_lhs_path.ident.name == Symbol::intern("len");
7169
if let Some(arg_lhs_struct) = lhs_args.get(0);
7270

7371
if SpanlessEq::new(cx).eq_expr(struct_calling_on, arg_lhs_struct);

0 commit comments

Comments
 (0)