diff options
| author | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-07-25 09:30:10 +0800 |
|---|---|---|
| committer | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-07-25 09:30:10 +0800 |
| commit | d5256b75dfca78e257748ec01947e7327ea627bd (patch) | |
| tree | fb87e5e201757ae45aea9c9ac013736a0ac594cf | |
| parent | 40c0339cf689f74b62b90297f21c4176af1193fc (diff) | |
| download | rust-d5256b75dfca78e257748ec01947e7327ea627bd.tar.gz rust-d5256b75dfca78e257748ec01947e7327ea627bd.zip | |
Update comment and do suggest
| -rw-r--r-- | src/librustc/traits/error_reporting.rs | 17 |
1 files 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, |
