Skip to content

Commit 1dfec45

Browse files
committed
Remove unnecessary .collect()
1 parent 987155f commit 1dfec45

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_errors/src/diagnostic.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -777,15 +777,15 @@ impl Diagnostic {
777777
applicability: Applicability,
778778
style: SuggestionStyle,
779779
) -> &mut Self {
780-
let suggestions: Vec<_> = suggestions.into_iter().collect();
781-
debug_assert!(
782-
!(sp.is_empty() && suggestions.iter().any(|suggestion| suggestion.is_empty())),
783-
"Span must not be empty and have no suggestion"
784-
);
785-
786780
let substitutions = suggestions
787781
.into_iter()
788-
.map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] })
782+
.map(|snippet| {
783+
debug_assert!(
784+
!(sp.is_empty() && snippet.is_empty()),
785+
"Span must not be empty and have no suggestion"
786+
);
787+
Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] }
788+
})
789789
.collect();
790790
self.push_suggestion(CodeSuggestion {
791791
substitutions,

0 commit comments

Comments
 (0)