update uses of extract_if in the compiler
This commit is contained in:
parent
03f1b73339
commit
fe521506a6
7 changed files with 13 additions and 13 deletions
|
@ -1569,18 +1569,18 @@ impl DiagCtxtInner {
|
|||
debug!(?diagnostic);
|
||||
debug!(?self.emitted_diagnostics);
|
||||
|
||||
let already_emitted_sub = |sub: &mut Subdiag| {
|
||||
let not_yet_emitted = |sub: &mut Subdiag| {
|
||||
debug!(?sub);
|
||||
if sub.level != OnceNote && sub.level != OnceHelp {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
let mut hasher = StableHasher::new();
|
||||
sub.hash(&mut hasher);
|
||||
let diagnostic_hash = hasher.finish();
|
||||
debug!(?diagnostic_hash);
|
||||
!self.emitted_diagnostics.insert(diagnostic_hash)
|
||||
self.emitted_diagnostics.insert(diagnostic_hash)
|
||||
};
|
||||
diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {});
|
||||
diagnostic.children.retain_mut(not_yet_emitted);
|
||||
if already_emitted {
|
||||
let msg = "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`";
|
||||
diagnostic.sub(Note, msg, MultiSpan::new());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue