Skip to content

Commit

Permalink
formatting nits
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Jul 14, 2020
1 parent 201999c commit e83b3eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ fn lint_iter_nth_zero<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, nth_ar
ITER_NTH_ZERO,
expr.span,
"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)),
applicability,
);
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/iter_nth_zero.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> $DIR/iter_nth_zero.rs:20:14
|
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`

error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> $DIR/iter_nth_zero.rs:25:14
|
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
--> $DIR/iter_nth_zero.rs:30:22
|
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

0 comments on commit e83b3eb

Please sign in to comment.