Skip to content

Commit

Permalink
Fix to use for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
long-long-float committed Feb 10, 2024
1 parent 44616e1 commit 1e59e66
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,16 +519,15 @@ impl Diagnostic {

/// Helper for pushing to `self.suggestions`, if available (not disable).
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
let in_derive = suggestion.substitutions.iter().any(|subst| {
subst.parts.iter().any(|part| {
for subst in &suggestion.substitutions {
for part in &subst.parts {
let span = part.span;
let call_site = span.ctxt().outer_expn_data().call_site;
span.in_derive_expansion() && span.overlaps_or_adjacent(call_site)
})
});
if in_derive {
// Ignore if spans is from derive macro.
return;
if span.in_derive_expansion() && span.overlaps_or_adjacent(call_site) {
// Ignore if spans is from derive macro.
return;
}
}
}

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

0 comments on commit 1e59e66

Please sign in to comment.