mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Add some reviewer comments
This commit is contained in:
parent
9806b31d53
commit
b73efad600
3 changed files with 6 additions and 6 deletions
|
@ -1173,7 +1173,7 @@ fn lint_unnecessary_fold(cx: &LateContext, expr: &hir::Expr, fold_args: &[hir::E
|
|||
".{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 lint_unnecessary_fold(cx: &LateContext, expr: &hir::Expr, fold_args: &[hir::E
|
|||
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 a new issue