Skip to content

Commit e83b3eb

Browse files
committed
formatting nits
1 parent 201999c commit e83b3eb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ fn lint_iter_nth_zero<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, nth_ar
23492349
ITER_NTH_ZERO,
23502350
expr.span,
23512351
"called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent",
2352-
"try calling .next() instead of .nth(0)",
2352+
"try calling `.next()` instead of `.nth(0)`",
23532353
format!("{}.next()", snippet_with_applicability(cx, nth_args[0].span, "..", &mut applicability)),
23542354
applicability,
23552355
);

tests/ui/iter_nth_zero.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
22
--> $DIR/iter_nth_zero.rs:20:14
33
|
44
LL | let _x = s.iter().nth(0);
5-
| ^^^^^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `s.iter().next()`
5+
| ^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `s.iter().next()`
66
|
77
= note: `-D clippy::iter-nth-zero` implied by `-D warnings`
88

99
error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
1010
--> $DIR/iter_nth_zero.rs:25:14
1111
|
1212
LL | let _y = iter.nth(0);
13-
| ^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `iter.next()`
13+
| ^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter.next()`
1414

1515
error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
1616
--> $DIR/iter_nth_zero.rs:30:22
1717
|
1818
LL | let _unwrapped = iter2.nth(0).unwrap();
19-
| ^^^^^^^^^^^^ help: try calling .next() instead of .nth(0): `iter2.next()`
19+
| ^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter2.next()`
2020

2121
error: aborting due to 3 previous errors
2222

0 commit comments

Comments
 (0)