1
Fork 0

s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList

This commit is contained in:
The 8472 2023-04-09 00:37:21 +02:00
parent b7ce7edd87
commit 114d5f221c
31 changed files with 204 additions and 216 deletions

View file

@ -2,7 +2,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![feature(box_patterns)]
#![feature(drain_filter)]
#![feature(is_sorted)]
#![feature(let_chains)]
#![feature(map_try_insert)]

View file

@ -436,13 +436,12 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> {
VarDebugInfoContents::Composite { ty: _, ref mut fragments } => {
let mut new_fragments = Vec::new();
debug!(?fragments);
fragments
.drain_filter(|fragment| {
if let Some(repl) =
fragments.retain_mut(|fragment| {
if let Some(repl) =
self.replacements.replace_place(self.tcx, fragment.contents.as_ref())
{
fragment.contents = repl;
false
true
} else if let Some(local) = fragment.contents.as_local()
&& let Some(frg) = self.gather_debug_info_fragments(local)
{
@ -450,12 +449,11 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> {
f.projection.splice(0..0, fragment.projection.iter().copied());
f
}));
true
} else {
false
} else {
true
}
})
.for_each(drop);
});
debug!(?fragments);
debug!(?new_fragments);
fragments.extend(new_fragments);