-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
m: Remove futures-lite dependency #36
Conversation
LGTM otherwise. 👍 |
Co-authored-by: Zeeshan Ali Khan <zeenix@gmail.com>
@@ -768,42 +760,48 @@ fn now_or_never<T>(f: impl Future<Output = T>) -> T { | |||
} | |||
unsafe fn drop(_: *const ()) {} | |||
|
|||
futures_lite::pin!(f); | |||
// SAFETY: We don't move the future after we pin it here. | |||
let future = unsafe { Pin::new_unchecked(&mut f) }; |
There was a problem hiding this comment.
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.
We didn't really use much from
futures-lite
, butfutures-lite
balloons our dependency count significantly. This PR inlines what we do use fromfutures-lite
.