1
Fork 0

use Result::into_ok on infallible result.

This commit is contained in:
Joshua Wong 2024-05-18 19:15:21 -05:00
parent 9d6b93c3e6
commit 65e302fc36
2 changed files with 3 additions and 4 deletions

View file

@ -160,6 +160,7 @@
#![feature(tuple_trait)] #![feature(tuple_trait)]
#![feature(unicode_internals)] #![feature(unicode_internals)]
#![feature(unsize)] #![feature(unsize)]
#![feature(unwrap_infallible)]
#![feature(vec_pop_if)] #![feature(vec_pop_if)]
// tidy-alphabetical-end // tidy-alphabetical-end
// //

View file

@ -374,10 +374,8 @@ where
// - unlike most internal iteration methods, it only takes a &mut self // - unlike most internal iteration methods, it only takes a &mut self
// - it lets us thread the write pointer through its innards and get it back in the end // - it lets us thread the write pointer through its innards and get it back in the end
let sink = InPlaceDrop { inner: dst_buf, dst: dst_buf }; let sink = InPlaceDrop { inner: dst_buf, dst: dst_buf };
let sink = match self.try_fold::<_, _, Result<_, !>>(sink, write_in_place_with_drop(end)) { let sink =
Ok(sink) => sink, self.try_fold::<_, _, Result<_, !>>(sink, write_in_place_with_drop(end)).into_ok();
Err(never) => match never {},
};
// iteration succeeded, don't drop head // iteration succeeded, don't drop head
unsafe { ManuallyDrop::new(sink).dst.sub_ptr(dst_buf) } unsafe { ManuallyDrop::new(sink).dst.sub_ptr(dst_buf) }
} }