use stable sort to sort multipart diagnostics
This commit is contained in:
parent
9337f7afa6
commit
38874a6927
2 changed files with 3 additions and 3 deletions
|
@ -1124,8 +1124,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||||
err.multipart_suggestion(
|
err.multipart_suggestion(
|
||||||
"consider moving the expression out of the loop so it is only moved once",
|
"consider moving the expression out of the loop so it is only moved once",
|
||||||
vec![
|
vec![
|
||||||
(parent.span, "value".to_string()),
|
|
||||||
(span.shrink_to_lo(), format!("let mut value = {value};{indent}")),
|
(span.shrink_to_lo(), format!("let mut value = {value};{indent}")),
|
||||||
|
(parent.span, "value".to_string()),
|
||||||
],
|
],
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
|
|
|
@ -920,8 +920,8 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
style: SuggestionStyle,
|
style: SuggestionStyle,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
suggestion.sort_unstable();
|
let mut seen = crate::FxHashSet::default();
|
||||||
suggestion.dedup_by(|(s1, m1), (s2, m2)| s1.source_equal(*s2) && m1 == m2);
|
suggestion.retain(|(span, msg)| seen.insert((span.lo(), span.hi(), msg.clone())));
|
||||||
|
|
||||||
let parts = suggestion
|
let parts = suggestion
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue