Skip to content
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

Merged
merged 3 commits into from
Jan 26, 2023
Merged

m: Remove futures-lite dependency #36

merged 3 commits into from
Jan 26, 2023

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.

src/barrier.rs Show resolved Hide resolved
src/once_cell.rs Outdated Show resolved Hide resolved
src/once_cell.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@zeenix
Copy link
Member

zeenix commented Jan 26, 2023

LGTM otherwise. 👍

Co-authored-by: Zeeshan Ali Khan <zeenix@gmail.com>
@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
@@ -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) };
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.

3 participants