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

protocols/: Remove passing default variant to WithPeerId::condition #2802

Merged
merged 2 commits into from
Aug 10, 2022
Merged

protocols/: Remove passing default variant to WithPeerId::condition #2802

merged 2 commits into from
Aug 10, 2022

Conversation

K0UR05H
Copy link
Contributor

@K0UR05H K0UR05H commented Aug 6, 2022

Description

Since PeerCondition::Disconnected is the default variant and is used here, there is no need to pass it again to WithPeerId::condition.

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@elenaf9
Copy link
Contributor

elenaf9 commented Aug 7, 2022

Thank you for contributing @k0ur0x!
I am not sure whether it's a good idea to remove the explicit .condition(dial_opts::PeerCondition::Disconnected). Being explicit about things imo generally makes maintaining the code easier. It saves trouble in the future when you look back at some code wondering "Was using the default value a conscious choice?". Especially if we ever decided to change the default value.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @k0ur0x.

I don't have a strong opinion here.

I think the choice of using PeerCondition::Disconnected is reasonably obvious in each of these cases, thus I don't think there is any need to be explicit and thus I think we can just depend on the default behavior as proposed in this pull request.

Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

I don't have a strong opinion here.

I think the choice of using PeerCondition::Disconnected is reasonably obvious in each of these cases, thus I don't think there is any need to be explicit and thus I think we can just depend on the default behavior as proposed in this pull request.

Makes sense. No strong opinion on my side either.

@mxinden mxinden merged commit 1012579 into libp2p:master Aug 10, 2022
@K0UR05H K0UR05H deleted the rm-default branch August 12, 2022 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants