Skip to content

Commit

Permalink
Merge branch 'use_last' of github.com:HarrisonMc555/rust-clippy into …
Browse files Browse the repository at this point in the history
…use_last
  • Loading branch information
HarrisonMc555 committed May 20, 2019
2 parents a74055b + 7f4896f commit 60ddb60
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clippy_lints/src/get_last_with_len.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for GetLastWithLen {
let vec_name = snippet_with_applicability(
cx,
struct_calling_on.span, "vec",
&mut applicability);
&mut applicability,
);

span_lint_and_sugg(
cx,
GET_LAST_WITH_LEN,
expr.span,
&format!("accessing last element with `{}.get({}.len() - 1)`",
&format!("accessing last element with `{0}.get({0}.len() - 1)`", vec_name),
vec_name,
vec_name),
"try",
Expand Down

0 comments on commit 60ddb60

Please sign in to comment.