Skip to content

Commit 1e59e66

Browse files
Fix to use for loop
1 parent 44616e1 commit 1e59e66

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

compiler/rustc_errors/src/diagnostic.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,15 @@ impl Diagnostic {
519519

520520
/// Helper for pushing to `self.suggestions`, if available (not disable).
521521
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
522-
let in_derive = suggestion.substitutions.iter().any(|subst| {
523-
subst.parts.iter().any(|part| {
522+
for subst in &suggestion.substitutions {
523+
for part in &subst.parts {
524524
let span = part.span;
525525
let call_site = span.ctxt().outer_expn_data().call_site;
526-
span.in_derive_expansion() && span.overlaps_or_adjacent(call_site)
527-
})
528-
});
529-
if in_derive {
530-
// Ignore if spans is from derive macro.
531-
return;
526+
if span.in_derive_expansion() && span.overlaps_or_adjacent(call_site) {
527+
// Ignore if spans is from derive macro.
528+
return;
529+
}
530+
}
532531
}
533532

534533
if let Ok(suggestions) = &mut self.suggestions {

0 commit comments

Comments
 (0)