Skip to content

Commit 82a0122

Browse files
committed
Merge duplicate suggestion string
1 parent 344ea6e commit 82a0122

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_infer/src/infer/error_reporting

1 file changed

+4
-7
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -2125,22 +2125,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
21252125
let Ok(code) = self.tcx.sess().source_map().span_to_snippet(span)
21262126
else { return };
21272127

2128+
let msg = "use a trailing comma to create a tuple with one element";
21282129
if code.starts_with('(') && code.ends_with(')') {
21292130
let before_close = span.hi() - BytePos::from_u32(1);
2130-
21312131
err.span_suggestion(
21322132
span.with_hi(before_close).shrink_to_hi(),
2133-
"use a trailing comma to create a tuple with one element",
2133+
msg,
21342134
",".into(),
21352135
Applicability::MachineApplicable,
21362136
);
21372137
} else {
21382138
err.multipart_suggestion(
2139-
"use a trailing comma to create a tuple with one element",
2140-
vec![
2141-
(span.shrink_to_lo(), "(".into()),
2142-
(span.shrink_to_hi(), ",)".into()),
2143-
],
2139+
msg,
2140+
vec![(span.shrink_to_lo(), "(".into()), (span.shrink_to_hi(), ",)".into())],
21442141
Applicability::MachineApplicable,
21452142
);
21462143
}

0 commit comments

Comments
 (0)