From d5256b75dfca78e257748ec01947e7327ea627bd Mon Sep 17 00:00:00 2001 From: csmoe <35686186+csmoe@users.noreply.github.com> Date: Wed, 25 Jul 2018 09:30:10 +0800 Subject: [PATCH] Update comment and do suggest --- src/librustc/traits/error_reporting.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 72ca6a4af17..8300f98fb1c 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1051,8 +1051,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { err.span_label(found_span, format!("takes {}", found_str)); // Suggest to take and ignore the arguments with expected_args_length `_`s if - // found arguments is empty(Suppose the user just wants to ignore args in this case). - // like `|_, _|` for closure with 2 expected args. + // found arguments is empty (assume the user just wants to ignore args in this case). + // For example, if `expected_args_length` is 2, suggest `|_, _|`. if found_args.is_empty() && is_closure { let mut underscores = "_".repeat(expected_args.len()) .split("") @@ -1061,12 +1061,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .join(", "); err.span_suggestion_with_applicability( found_span, - &format!("change the closure to take and ignore the expected argument{}", - if expected_args.len() < 2 { - "" - } else { - "s" - } + &format!( + "consider changing the closure to take and ignore the expected argument{}", + if expected_args.len() < 2 { + "" + } else { + "s" + } ), format!("|{}|", underscores), Applicability::MachineApplicable,