diff options
| author | long-long-float <niinikazuki@yahoo.co.jp> | 2024-02-11 02:43:55 +0900 |
|---|---|---|
| committer | long-long-float <niinikazuki@yahoo.co.jp> | 2024-02-11 02:43:55 +0900 |
| commit | 1e59e662258fc301dd7b396ac0e3686568a71164 (patch) | |
| tree | 6bc3738deb3abffe8948688e818d27e824e84bad /compiler/rustc_errors/src | |
| parent | 44616e11d080f7051a05ae6977c303b42efdcf89 (diff) | |
| download | rust-1e59e662258fc301dd7b396ac0e3686568a71164.tar.gz rust-1e59e662258fc301dd7b396ac0e3686568a71164.zip | |
Fix to use for loop
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 026b0222665..c48a8e12a00 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -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 { |
