diff options
| author | Joshua Wong <joshuawong@anticentri.st> | 2024-05-18 19:15:21 -0500 |
|---|---|---|
| committer | Joshua Wong <joshuawong@anticentri.st> | 2024-05-18 19:15:21 -0500 |
| commit | 65e302fc3648c2268fecbff10a861f5bd3e0f67d (patch) | |
| tree | 643c300acbb284cc8f2504e6b60db9ea4de46c99 /library/alloc/src/vec | |
| parent | 9d6b93c3e6609aa104da23cb9091c6c2e277f71e (diff) | |
use `Result::into_ok` on infallible result.
Diffstat (limited to 'library/alloc/src/vec')
| -rw-r--r-- | library/alloc/src/vec/in_place_collect.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/library/alloc/src/vec/in_place_collect.rs b/library/alloc/src/vec/in_place_collect.rs index 5b0fde93b91..22541a2b9d8 100644 --- a/library/alloc/src/vec/in_place_collect.rs +++ b/library/alloc/src/vec/in_place_collect.rs @@ -374,10 +374,8 @@ where // - 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 let sink = InPlaceDrop { inner: dst_buf, dst: dst_buf }; - let sink = match self.try_fold::<_, _, Result<_, !>>(sink, write_in_place_with_drop(end)) { - Ok(sink) => sink, - Err(never) => match never {}, - }; + let sink = + self.try_fold::<_, _, Result<_, !>>(sink, write_in_place_with_drop(end)).into_ok(); // iteration succeeded, don't drop head unsafe { ManuallyDrop::new(sink).dst.sub_ptr(dst_buf) } } |
