Skip to content

Commit ad9bdc5

Browse files
committed
remove a needless variable
1 parent 595b478 commit ad9bdc5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_lints/src/methods/iter_skip_next.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, skip_args: &[hir
1212
// lint if caller of skip is an Iterator
1313
if is_trait_method(cx, expr, sym::Iterator) {
1414
if let [caller, n] = skip_args {
15-
let hint = format!(".nth({})", snippet(cx, n.span, ".."));
1615
span_lint_and_sugg(
1716
cx,
1817
ITER_SKIP_NEXT,
1918
expr.span.trim_start(caller.span).unwrap(),
2019
"called `skip(..).next()` on an iterator",
2120
"use `nth` instead",
22-
hint,
21+
format!(".nth({})", snippet(cx, n.span, "..")),
2322
Applicability::MachineApplicable,
2423
);
2524
}

0 commit comments

Comments
 (0)