iter-next-slice: make lint adhere to lint message convention

This commit is contained in:
Matthias Krüger 2020-08-11 12:42:50 +02:00
parent 04867e004e
commit 6af297f80e
2 changed files with 6 additions and 6 deletions

View file

@ -2280,7 +2280,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
cx,
ITER_NEXT_SLICE,
expr.span,
"Using `.iter().next()` on a Slice without end index.",
"using `.iter().next()` on a Slice without end index",
"try calling",
format!("{}.get({})", snippet_with_applicability(cx, caller_var.span, "..", &mut applicability), start_idx),
applicability,
@ -2299,7 +2299,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
cx,
ITER_NEXT_SLICE,
expr.span,
"Using `.iter().next()` on an array",
"using `.iter().next()` on an array",
"try calling",
format!(
"{}.get(0)",

View file

@ -1,4 +1,4 @@
error: Using `.iter().next()` on an array
error: using `.iter().next()` on an array
--> $DIR/iter_next_slice.rs:9:5
|
LL | s.iter().next();
@ -6,19 +6,19 @@ LL | s.iter().next();
|
= note: `-D clippy::iter-next-slice` implied by `-D warnings`
error: Using `.iter().next()` on a Slice without end index.
error: using `.iter().next()` on a Slice without end index
--> $DIR/iter_next_slice.rs:12:5
|
LL | s[2..].iter().next();
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)`
error: Using `.iter().next()` on a Slice without end index.
error: using `.iter().next()` on a Slice without end index
--> $DIR/iter_next_slice.rs:15:5
|
LL | v[5..].iter().next();
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)`
error: Using `.iter().next()` on an array
error: using `.iter().next()` on an array
--> $DIR/iter_next_slice.rs:18:5
|
LL | v.iter().next();