Skip to content

Commit fe0aab9

Browse files
committed
remove a needless variable
1 parent 81be5e0 commit fe0aab9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_lints/src/methods/iter_skip_next.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, skip_args: &[hir
1010
// lint if caller of skip is an Iterator
1111
if is_trait_method(cx, expr, sym::Iterator) {
1212
if let [caller, n] = skip_args {
13-
let hint = format!(".nth({})", snippet(cx, n.span, ".."));
1413
span_lint_and_sugg(
1514
cx,
1615
ITER_SKIP_NEXT,
1716
expr.span.trim_start(caller.span).unwrap(),
1817
"called `skip(..).next()` on an iterator",
1918
"use `nth` instead",
20-
hint,
19+
format!(".nth({})", snippet(cx, n.span, "..")),
2120
Applicability::MachineApplicable,
2221
);
2322
}

0 commit comments

Comments
 (0)