Skip to content

Commit c8f44c3

Browse files
committed
use Result::into_ok on infallible result.
1 parent 6e066ce commit c8f44c3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

alloc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
#![feature(tuple_trait)]
161161
#![feature(unicode_internals)]
162162
#![feature(unsize)]
163+
#![feature(unwrap_infallible)]
163164
#![feature(vec_pop_if)]
164165
// tidy-alphabetical-end
165166
//

alloc/src/vec/in_place_collect.rs

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

0 commit comments

Comments
 (0)