Skip to content

Commit 5c18d7d

Browse files
committed
Typo
1 parent 7dd3a62 commit 5c18d7d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clippy_lints/src/methods/manual_try_fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ pub(super) fn check<'tcx>(
3333
&& let ExprKind::Path(qpath) = path.kind
3434
&& let Res::Def(DefKind::Ctor(_, _), _) = cx.qpath_res(&qpath, path.hir_id)
3535
&& let ExprKind::Closure(closure) = acc.kind
36-
&& let Some(args_snip) = closure.fn_arg_span.and_then(|fn_arg_span| snippet_opt(cx, fn_arg_span))
3736
&& !is_from_proc_macro(cx, expr)
37+
&& let Some(args_snip) = closure.fn_arg_span.and_then(|fn_arg_span| snippet_opt(cx, fn_arg_span))
3838
{
3939
let init_snip = rest
4040
.is_empty()
@@ -48,7 +48,7 @@ pub(super) fn check<'tcx>(
4848
fold_span,
4949
"you seem to be using `Iterator::fold` on a type that implements `Try`",
5050
"use `try_fold` instead",
51-
format!("try_fold({init_snip}, {args_snip}, ...)", ),
51+
format!("try_fold({init_snip}, {args_snip} ...)", ),
5252
Applicability::HasPlaceholders,
5353
);
5454
}

tests/ui/manual_try_fold.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ error: you seem to be using `Iterator::fold` on a type that implements `Try`
22
--> $DIR/manual_try_fold.rs:61:10
33
|
44
LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i|, ...)`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
66
|
77
= note: `-D clippy::manual-try-fold` implied by `-D warnings`
88

99
error: you seem to be using `Iterator::fold` on a type that implements `Try`
1010
--> $DIR/manual_try_fold.rs:65:10
1111
|
1212
LL | .fold(NotOption(0i32, 0i32), |sum, i| NotOption(0i32, 0i32));
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(..., |sum, i|, ...)`
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(..., |sum, i| ...)`
1414

1515
error: you seem to be using `Iterator::fold` on a type that implements `Try`
1616
--> $DIR/manual_try_fold.rs:68:10
1717
|
1818
LL | .fold(NotOptionButWorse(0i32), |sum, i| NotOptionButWorse(0i32));
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i|, ...)`
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
2020

2121
error: you seem to be using `Iterator::fold` on a type that implements `Try`
2222
--> $DIR/manual_try_fold.rs:98:10
2323
|
2424
LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
25-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i|, ...)`
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
2626

2727
error: aborting due to 4 previous errors
2828

0 commit comments

Comments
 (0)