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

Remove the implementations of std::ops::Not #656

Closed
dtolnay opened this Issue Aug 18, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@dtolnay
Copy link

dtolnay commented Aug 18, 2017

From what I can tell, the only reason these exists is to be used in the implementation of Sub and SubAssign.

impl<T: Into<Ready>> ops::Sub<T> for Ready {
    type Output = Ready;

    fn sub(self, other: T) -> Ready {
        Ready(self.0 & !other.into().0)
    }
}

impl<T: Into<Ready>> ops::SubAssign<T> for Ready {
    fn sub_assign(&mut self, other: T) {
        self.0 &= !other.into().0;
    }
}

Other than in Sub, it never makes sense to apply Not to a Ready. You would never call Poll::register and pass the Not of a Ready, for example. Let's reimplement Sub in a different way and remove the semantically meaningless Not operation.

Applies to Ready, UnixReady, FuchsiaReady, and PollOpt.

@carllerche

This comment has been minimized.

Copy link
Owner

carllerche commented Aug 18, 2017

Before doing this, the git history should be checked for any potential info on why it was originally added.

@ahmedcharles

This comment has been minimized.

Copy link
Collaborator

ahmedcharles commented Aug 23, 2017

The impl for PollOpt was added in: 0122914

It doesn't seem to explain why.

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Aug 23, 2017

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Aug 24, 2017

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Aug 28, 2017

carllerche added a commit to ahmedcharles/mio that referenced this issue Aug 31, 2017

carllerche added a commit that referenced this issue Aug 31, 2017

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Sep 12, 2017

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Nov 7, 2017

ahmedcharles added a commit to ahmedcharles/mio that referenced this issue Jan 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.