Skip to content

Commit d5256b7

Browse files
committed
Update comment and do suggest
1 parent 40c0339 commit d5256b7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/librustc/traits/error_reporting.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10511051
err.span_label(found_span, format!("takes {}", found_str));
10521052

10531053
// Suggest to take and ignore the arguments with expected_args_length `_`s if
1054-
// found arguments is empty(Suppose the user just wants to ignore args in this case).
1055-
// like `|_, _|` for closure with 2 expected args.
1054+
// found arguments is empty (assume the user just wants to ignore args in this case).
1055+
// For example, if `expected_args_length` is 2, suggest `|_, _|`.
10561056
if found_args.is_empty() && is_closure {
10571057
let mut underscores = "_".repeat(expected_args.len())
10581058
.split("")
@@ -1061,12 +1061,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10611061
.join(", ");
10621062
err.span_suggestion_with_applicability(
10631063
found_span,
1064-
&format!("change the closure to take and ignore the expected argument{}",
1065-
if expected_args.len() < 2 {
1066-
""
1067-
} else {
1068-
"s"
1069-
}
1064+
&format!(
1065+
"consider changing the closure to take and ignore the expected argument{}",
1066+
if expected_args.len() < 2 {
1067+
""
1068+
} else {
1069+
"s"
1070+
}
10701071
),
10711072
format!("|{}|", underscores),
10721073
Applicability::MachineApplicable,

0 commit comments

Comments
 (0)