Skip to content

Commit 487feba

Browse files
committed
Remove comments from use_last.rs
1 parent b95a6f2 commit 487feba

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

clippy_lints/src/use_last.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,58 +55,42 @@ impl LintPass for UseLast {
5555
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseLast {
5656
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
5757
if_chain! {
58-
// let _ = println!("Starting UseLast");
5958
// Is a method call
6059
if let ExprKind::MethodCall(ref path, _, ref args) = expr.node;
61-
// let _ = println!("It is a MethodCall");
6260

6361
// Method name is "get"
6462
if path.ident.name == "get";
65-
// let _ = println!("The name is get");
6663

6764
// Argument 0 (the struct we're calling the method on) is a vector
6865
if let Some(struct_calling_on) = args.get(0);
69-
// let _ = println!("It had an argument");
7066
let struct_ty = cx.tables.expr_ty(struct_calling_on);
7167
if match_type(cx, struct_ty, &paths::VEC);
72-
// let _ = println!("It was a vector");
7368

7469
// Argument to "get" is a binary operation
7570
if let Some(get_index_arg) = args.get(1);
76-
// let _ = println!("It had an argument");
7771
if let rustc::hir::ExprKind::Binary(ref op, ref lhs, ref rhs) = get_index_arg.node;
78-
// let _ = println!("It was a vector");
7972

8073
// Binary operation is a subtraction
8174
if op.node == rustc::hir::BinOpKind::Sub;
82-
// let _ = println!("It was a subtraction");
8375

8476
// LHS of subtraction is "x.len()"
8577
if let ExprKind::MethodCall(ref arg_lhs_path, _, ref lhs_args) = lhs.node;
86-
// let _ = println!("LHS of sub is a method call");
8778
if arg_lhs_path.ident.name == "len";
88-
// let _ = println!("LHS of sub was method named len");
8979
if let Some(arg_lhs_struct) = lhs_args.get(0);
90-
// let _ = println!("LHS of sub method has an arg");
9180

9281
// TODO: Is this a valid way to check if they reference the same vector?
9382
if let ExprKind::Path(arg_lhs_struct_path) = arg_lhs_struct.node;
9483
if let ExprKind::Path(struct_calling_on_path) = struct_calling_on.nod
9584
if arg_lhs_struct_path == struct_calling_on_path;
96-
// let _ = println!("The vector in .get and .len were the same");
9785

9886
// RHS of subtraction is 1
9987
if let ExprKind::Lit(ref rhs_lit) = rhs.node;
100-
// let _ = println!("RHS of sub was literal");
10188
if let LitKind::Int(rhs_value, ..) = rhs_lit.node;
102-
// let _ = println!("RHS of sub was int");
10389
if rhs_value == 1;
104-
// let _ = println!("RHS of sub was 1");
10590

10691
let mut applicability = Applicability::MachineApplicable;
10792
let vec_name = snippet_with_applicability(
10893
cx, struct_calling_on.span, "x", &mut applicability);
109-
// let _ = println!("About to span_lint on \"{}\"", vec_name);
11094

11195
then {
11296
span_lint_and_sugg(

0 commit comments

Comments
 (0)