Skip to content

Commit

Permalink
Re-implement project through as_pin_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Jan 17, 2023
1 parent 824a1c6 commit ab7bb93
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions futures-util/src/future/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ pub enum Either<A, B> {

impl<A, B> Either<A, B> {
fn project(self: Pin<&mut Self>) -> Either<Pin<&mut A>, Pin<&mut B>> {
unsafe {
match self.get_unchecked_mut() {
Either::Left(a) => Either::Left(Pin::new_unchecked(a)),
Either::Right(b) => Either::Right(Pin::new_unchecked(b)),
}
}
self.as_pin_mut()
}

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

0 comments on commit ab7bb93

Please sign in to comment.