<commit_before>use core::mem::PinMut;
use futures_core::Future;
use futures_core::task::{Context, Poll};

#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
crate enum Chain<Fut1, Fut2, Data> {
    First(Option<Fut1>, Option<Data>),
    Second(Fut2),
    Empty,
}

impl<Fut1, Fut2, Data> Chain<Fut1, Fut2, Data>
    where Fut1: Future,
          Fut2: Future,
{
    pub fn new(fut1: Fut1, data: Data) -> Chain<Fut1, Fut2, Data> {
        Chain::First(Some(fut1), Some(data))
    }

    pub fn poll<F>(
        self: PinMut<Self>,
        cx: &mut Context,
        async_op: F,
    ) -> Poll<Fut2::Output>
        where F: FnOnce(Fut1::Output, Data) -> Fut2,
    {
        let mut async_op = Some(async_op);

        // Safe to call `get_mut_unchecked` because we won't move the futures.
        let this = unsafe { PinMut::get_mut_unchecked(self) };

        loop {
            let (output, data) = match this {
                Chain::First(fut1, data) => {
                    match unsafe { PinMut::new_unchecked(fut1.as_mut().unwrap()) }.poll(cx) {
                        Poll::Pending => return Poll::Pending,
                        Poll::Ready(output) => (output, data.take().unwrap()),
                    }
                }
                Chain::Second(fut2) => {
                    return unsafe { PinMut::new_unchecked(fut2) }.poll(cx);
                }
                Chain::Empty => unreachable!()
            };<commit_msg>Remove unnecessary option in `Chain`<commit_after>use core::mem::PinMut;
use futures_core::Future;
use futures_core::task::{Context, Poll};

#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
crate enum Chain<Fut1, Fut2, Data> {
    First(Fut1, Option<Data>),
    Second(Fut2),
    Empty,
}

impl<Fut1, Fut2, Data> Chain<Fut1, Fut2, Data>
    where Fut1: Future,
          Fut2: Future,
{
    pub fn new(fut1: Fut1, data: Data) -> Chain<Fut1, Fut2, Data> {
        Chain::First(fut1, Some(data))
    }

    pub fn poll<F>(
        self: PinMut<Self>,
        cx: &mut Context,
        async_op: F,
    ) -> Poll<Fut2::Output>
        where F: FnOnce(Fut1::Output, Data) -> Fut2,
    {
        let mut async_op = Some(async_op);

        // Safe to call `get_mut_unchecked` because we won't move the futures.
        let this = unsafe { PinMut::get_mut_unchecked(self) };

        loop {
            let (output, data) = match this {
                Chain::First(fut1, data) => {
                    match unsafe { PinMut::new_unchecked(fut1) }.poll(cx) {
                        Poll::Pending => return Poll::Pending,
                        Poll::Ready(output) => (output, data.take().unwrap()),
                    }
                }
                Chain::Second(fut2) => {
                    return unsafe { PinMut::new_unchecked(fut2) }.poll(cx);
                }
                Chain::Empty => unreachable!()
            };
{'fraction_non_alphanumeric': 0.14320137693631668, 'fraction_numerical': 0.015146299483648882, 'mean_word_length': 1.998968008255934, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7566853', 'n_tokens_mistral': 963, 'n_tokens_neox': 949, 'n_words': 212}