From f1ae02f4bd971acc384ed3422e235fb1eb07dfa7 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Wed, 8 Nov 2023 18:24:49 +0000 Subject: Don't sort `span_suggestions`, leave that to caller --- compiler/rustc_errors/src/diagnostic.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index b379d17dc22..1c1da89c557 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -759,9 +759,6 @@ impl Diagnostic { suggestions: impl IntoIterator, applicability: Applicability, ) -> &mut Self { - let mut suggestions: Vec<_> = suggestions.into_iter().collect(); - suggestions.sort(); - self.span_suggestions_with_style( sp, msg, @@ -771,9 +768,7 @@ impl Diagnostic { ) } - /// [`Diagnostic::span_suggestions()`] but you can set the [`SuggestionStyle`]. This version - /// *doesn't* sort the suggestions, so the caller has control of the order in which they are - /// presented. + /// [`Diagnostic::span_suggestions()`] but you can set the [`SuggestionStyle`]. pub fn span_suggestions_with_style( &mut self, sp: Span, -- cgit 1.4.1-3-g733a5