formatting nits

This commit is contained in:
Brian Warner 2020-07-14 09:20:19 -07:00
parent 201999ccfd
commit e83b3eb993
2 changed files with 4 additions and 4 deletions

View file

@ -2349,7 +2349,7 @@ fn lint_iter_nth_zero<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, nth_ar
ITER_NTH_ZERO, ITER_NTH_ZERO,
expr.span, expr.span,
"called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent", "called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent",
"try calling .next() instead of .nth(0)", "try calling `.next()` instead of `.nth(0)`",
format!("{}.next()", snippet_with_applicability(cx, nth_args[0].span, "..", &mut applicability)), format!("{}.next()", snippet_with_applicability(cx, nth_args[0].span, "..", &mut applicability)),
applicability, applicability,
); );

View file

@ -2,7 +2,7 @@ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> $DIR/iter_nth_zero.rs:20:14 --> $DIR/iter_nth_zero.rs:20:14
| |
LL | let _x = s.iter().nth(0); LL | let _x = s.iter().nth(0);
| ^^^^^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `s.iter().next()` | ^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `s.iter().next()`
| |
= note: `-D clippy::iter-nth-zero` implied by `-D warnings` = note: `-D clippy::iter-nth-zero` implied by `-D warnings`
@ -10,13 +10,13 @@ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> $DIR/iter_nth_zero.rs:25:14 --> $DIR/iter_nth_zero.rs:25:14
| |
LL | let _y = iter.nth(0); LL | let _y = iter.nth(0);
| ^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `iter.next()` | ^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter.next()`
error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> $DIR/iter_nth_zero.rs:30:22 --> $DIR/iter_nth_zero.rs:30:22
| |
LL | let _unwrapped = iter2.nth(0).unwrap(); LL | let _unwrapped = iter2.nth(0).unwrap();
| ^^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `iter2.next()` | ^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter2.next()`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors