Skip to content

Commit 8e3301d

Browse files
committed
Add comments and run rustfmt
1 parent 568425c commit 8e3301d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/use_last.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
33
use crate::utils::{match_type, paths, snippet_with_applicability, span_lint_and_sugg, SpanlessEq};
44
use if_chain::if_chain;
5-
use rustc::hir::{Expr, ExprKind, BinOpKind};
5+
use rustc::hir::{BinOpKind, Expr, ExprKind};
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_lint_pass, declare_tool_lint};
88
use rustc_errors::Applicability;
99
use syntax::ast::LitKind;
10-
use syntax::symbol::Symbol;
1110
use syntax::source_map::Spanned;
11+
use syntax::symbol::Symbol;
1212

1313
declare_clippy_lint! {
1414
/// **What it does:** Checks for using `x.get(x.len() - 1)` instead of
@@ -68,6 +68,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseLast {
6868
if arg_lhs_path.ident.name == Symbol::intern("len");
6969
if let Some(arg_lhs_struct) = lhs_args.get(0);
7070

71+
// The two vectors referenced (x in x.get(...) and in x.len())
7172
if SpanlessEq::new(cx).eq_expr(struct_calling_on, arg_lhs_struct);
7273

7374
// RHS of subtraction is 1

0 commit comments

Comments
 (0)