Skip to content

Commit 09a3b8a

Browse files
Re-implement project through as_pin_mut
1 parent d1bd5f0 commit 09a3b8a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

futures-util/src/future/either.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ pub enum Either<A, B> {
3434

3535
impl<A, B> Either<A, B> {
3636
fn project(self: Pin<&mut Self>) -> Either<Pin<&mut A>, Pin<&mut B>> {
37-
unsafe {
38-
match self.get_unchecked_mut() {
39-
Either::Left(a) => Either::Left(Pin::new_unchecked(a)),
40-
Either::Right(b) => Either::Right(Pin::new_unchecked(b)),
41-
}
42-
}
37+
self.as_pin_mut()
4338
}
4439

4540
/// Convert `Pin<&Either<L, R>>` to `Either<Pin<&L>, Pin<&R>>`,

0 commit comments

Comments
 (0)