address comments
This commit is contained in:
parent
fbb3f759e2
commit
cb5d7e344a
5 changed files with 11 additions and 10 deletions
|
|
@ -46,7 +46,7 @@ pub(super) fn check<'tcx>(
|
|||
cx,
|
||||
MANUAL_TRY_FOLD,
|
||||
fold_span,
|
||||
"you seem to be using `Iterator::fold` on a type that implements `Try`",
|
||||
"usage of `Iterator::fold` on a type that implements `Try`",
|
||||
"use `try_fold` instead",
|
||||
format!("try_fold({init_snip}, {args_snip} ...)", ),
|
||||
Applicability::HasPlaceholders,
|
||||
|
|
|
|||
|
|
@ -3292,10 +3292,10 @@ declare_clippy_lint! {
|
|||
/// Checks for usage of `Iterator::fold` with a type that implements `Try`.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// This should use `try_fold` instead, which short-circuits on failure, thus opening the door
|
||||
/// for additional optimizations not possible with `fold` as rustc can guarantee the function is
|
||||
/// never called on `None`, `Err`, etc., alleviating otherwise necessary checks. It's also
|
||||
/// slightly more idiomatic.
|
||||
/// The code should use `try_fold` instead, which short-circuits on failure, thus opening the
|
||||
/// door for additional optimizations not possible with `fold` as rustc can guarantee the
|
||||
/// function is never called on `None`, `Err`, etc., alleviating otherwise necessary checks. It's
|
||||
/// also slightly more idiomatic.
|
||||
///
|
||||
/// ### Known issues
|
||||
/// This lint doesn't take into account whether a function does something on the failure case,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue