Skip to content

Conversation

@notgull
Copy link
Member

@notgull notgull commented Jan 26, 2023

We didn't really use much from futures-lite, but futures-lite balloons our dependency count significantly. This PR inlines what we do use from futures-lite.

@zeenix
Copy link
Member

zeenix commented Jan 26, 2023

LGTM otherwise. 👍

Co-authored-by: Zeeshan Ali Khan <[email protected]>
@notgull notgull merged commit 350cda0 into master Jan 26, 2023
@notgull notgull deleted the notgull/reduce-deps branch January 26, 2023 22:13
@notgull notgull mentioned this pull request Feb 25, 2023

futures_lite::pin!(f);
// SAFETY: We don't move the future after we pin it here.
let future = unsafe { Pin::new_unchecked(&mut f) };
Copy link
Collaborator

@taiki-e taiki-e Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly recommend that you use the same variable names here. Otherwise, it is very easy to access the owned value incorrectly.

Simple shadowing is not sufficient to prevent misuse, but in this case it is fine because it is on the outermost scope. (This is a common oversight, I sometimes see crates make the false claim that simple shadowing is "doing the exact same thing as pin_mut".)

Well, it would be better to duplicate the pin macro as you have done for the ready macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants