Add some reviewer comments
This commit is contained in:
parent
9806b31d53
commit
b73efad600
@ -1173,7 +1173,7 @@ fn check_fold_with_op(
|
||||
".{replacement}(|{s}| {r})",
|
||||
replacement = replacement_method_name,
|
||||
s = second_arg_ident,
|
||||
r = snippet(cx, right_expr.span, "EXPR")
|
||||
r = snippet(cx, right_expr.span, "EXPR"),
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
@ -1186,10 +1186,10 @@ fn check_fold_with_op(
|
||||
cx,
|
||||
UNNECESSARY_FOLD,
|
||||
fold_span,
|
||||
// TODO: don't suggest e.g. .any(|x| f(x)) if we can suggest .any(f)
|
||||
// TODO #2371 don't suggest e.g. .any(|x| f(x)) if we can suggest .any(f)
|
||||
"this `.fold` can be written more succinctly using another method",
|
||||
"try",
|
||||
sugg
|
||||
sugg,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(
|
||||
/// These suggestions can be parsed by rustfix to allow it to automatically fix your code.
|
||||
/// In the example below, `help` is `"try"` and `sugg` is the suggested replacement `".any(|x| x > 2)"`.
|
||||
///
|
||||
/// <pre>
|
||||
/// ```
|
||||
/// error: This `.fold` can be more succinctly expressed as `.any`
|
||||
/// --> $DIR/methods.rs:390:13
|
||||
/// |
|
||||
@ -609,7 +609,7 @@ pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(
|
||||
/// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
|
||||
/// |
|
||||
/// = note: `-D fold-any` implied by `-D warnings`
|
||||
/// </pre>
|
||||
/// ```
|
||||
pub fn span_lint_and_sugg<'a, 'tcx: 'a, T: LintContext<'tcx>>(
|
||||
cx: &'a T,
|
||||
lint: &'static Lint,
|
||||
|
@ -499,7 +499,7 @@ error: this `.fold` can be written more succinctly using another method
|
||||
391 | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
|
||||
|
|
||||
= note: `-D fold-any` implied by `-D warnings`
|
||||
= note: `-D unnecessary-fold` implied by `-D warnings`
|
||||
|
||||
error: this `.fold` can be written more succinctly using another method
|
||||
--> $DIR/methods.rs:393:19
|
||||
|
Loading…
Reference in New Issue
Block a user