"try not to call a closure in the expression where it is declared",
|diag| {
if fn_decl.inputs.is_empty() {
- let app = Applicability::MachineApplicable;
- let mut hint = Sugg::ast(cx, body, "..");
+ let mut app = Applicability::MachineApplicable;
+ let mut hint = Sugg::ast(cx, body, "..", closure.span.ctxt(), &mut app);
if asyncness.is_async() {
// `async x` is a syntax error, so it becomes `async { x }`
impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx hir::Block<'_>) {
- fn count_closure_usage<'a, 'tcx>(
- cx: &'a LateContext<'tcx>,
+ fn count_closure_usage<'tcx>(
+ cx: &LateContext<'tcx>,
block: &'tcx hir::Block<'_>,
path: &'tcx hir::Path<'tcx>,
) -> usize {