Always sort suggestions before emitting them
This commit is contained in:
parent
ef212e7fb3
commit
881a50c0b7
10 changed files with 39 additions and 35 deletions
|
@ -465,10 +465,14 @@ impl Diagnostic {
|
|||
suggestions: impl Iterator<Item = String>,
|
||||
applicability: Applicability,
|
||||
) -> &mut Self {
|
||||
let mut suggestions: Vec<_> = suggestions.collect();
|
||||
suggestions.sort();
|
||||
let substitutions = suggestions
|
||||
.into_iter()
|
||||
.map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] })
|
||||
.collect();
|
||||
self.suggestions.push(CodeSuggestion {
|
||||
substitutions: suggestions
|
||||
.map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] })
|
||||
.collect(),
|
||||
substitutions,
|
||||
msg: msg.to_owned(),
|
||||
style: SuggestionStyle::ShowCode,
|
||||
applicability,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue