Skip to content

Commit 1ac8b85

Browse files
committed
redundant_closure_call - pr review
1 parent 9603d96 commit 1ac8b85

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

clippy_lints/src/redundant_closure_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ impl EarlyLintPass for RedundantClosureCall {
7777
cx,
7878
REDUNDANT_CLOSURE_CALL,
7979
expr.span,
80-
"Try not to call a closure in the expression where it is declared.",
80+
"try not to call a closure in the expression where it is declared.",
8181
|diag| {
8282
if decl.inputs.is_empty() {
8383
let mut app = Applicability::MachineApplicable;
8484
let hint =
8585
snippet_with_applicability(cx, block.span, "..", &mut app).into_owned();
86-
diag.span_suggestion(expr.span, "Try doing something like: ", hint, app);
86+
diag.span_suggestion(expr.span, "try doing something like", hint, app);
8787
}
8888
},
8989
);
@@ -136,13 +136,13 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
136136
if let hir::ExprKind::Call(ref closure, _) = call.kind;
137137
if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = closure.kind;
138138
if ident == path.segments[0].ident;
139-
if count_closure_usage(block, path) == 1;
139+
if count_closure_usage(block, path) == 1;
140140
then {
141141
span_lint(
142142
cx,
143143
REDUNDANT_CLOSURE_CALL,
144144
second.span,
145-
"Closure called just once immediately after it was declared",
145+
"closure called just once immediately after it was declared",
146146
);
147147
}
148148
}

tests/ui/redundant_closure_call_early.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error: Try not to call a closure in the expression where it is declared.
1+
error: try not to call a closure in the expression where it is declared.
22
--> $DIR/redundant_closure_call_early.rs:9:17
33
|
44
LL | let mut k = (|m| m + 1)(i);
55
| ^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::redundant-closure-call` implied by `-D warnings`
88

9-
error: Try not to call a closure in the expression where it is declared.
9+
error: try not to call a closure in the expression where it is declared.
1010
--> $DIR/redundant_closure_call_early.rs:12:9
1111
|
1212
LL | k = (|a, b| a * b)(1, 5);

tests/ui/redundant_closure_call_fixable.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Try not to call a closure in the expression where it is declared.
1+
error: try not to call a closure in the expression where it is declared.
22
--> $DIR/redundant_closure_call_fixable.rs:7:13
33
|
44
LL | let a = (|| 42)();
5-
| ^^^^^^^^^ help: Try doing something like: : `42`
5+
| ^^^^^^^^^ help: try doing something like: `42`
66
|
77
= note: `-D clippy::redundant-closure-call` implied by `-D warnings`
88

tests/ui/redundant_closure_call_late.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
error: Closure called just once immediately after it was declared
1+
error: closure called just once immediately after it was declared
22
--> $DIR/redundant_closure_call_late.rs:15:5
33
|
44
LL | i = redun_closure();
55
| ^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::redundant-closure-call` implied by `-D warnings`
88

9-
error: Closure called just once immediately after it was declared
9+
error: closure called just once immediately after it was declared
1010
--> $DIR/redundant_closure_call_late.rs:19:5
1111
|
1212
LL | i = shadowed_closure();
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

15-
error: Closure called just once immediately after it was declared
15+
error: closure called just once immediately after it was declared
1616
--> $DIR/redundant_closure_call_late.rs:21:5
1717
|
1818
LL | i = shadowed_closure();

0 commit comments

Comments
 (0)