diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-11-08 23:23:26 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-11-19 17:50:47 +0000 |
| commit | 1dfec45dc99d7d699bdf470d042300102e1589bc (patch) | |
| tree | 63b34090b7848cf37016ebb444310d9b3108afc7 /compiler/rustc_errors | |
| parent | 987155f35d6a534f58208a0f59a0df22cbaf38cb (diff) | |
| download | rust-1dfec45dc99d7d699bdf470d042300102e1589bc.tar.gz rust-1dfec45dc99d7d699bdf470d042300102e1589bc.zip | |
Remove unnecessary .collect()
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 1c1da89c557..0aaa8ae69e1 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -777,15 +777,15 @@ impl Diagnostic { applicability: Applicability, style: SuggestionStyle, ) -> &mut Self { - let suggestions: Vec<_> = suggestions.into_iter().collect(); - debug_assert!( - !(sp.is_empty() && suggestions.iter().any(|suggestion| suggestion.is_empty())), - "Span must not be empty and have no suggestion" - ); - let substitutions = suggestions .into_iter() - .map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] }) + .map(|snippet| { + debug_assert!( + !(sp.is_empty() && snippet.is_empty()), + "Span must not be empty and have no suggestion" + ); + Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] } + }) .collect(); self.push_suggestion(CodeSuggestion { substitutions, |
