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

change AmqpVersion to struct #927

Merged
merged 1 commit into from
Aug 19, 2020
Merged

Conversation

bollhals
Copy link
Contributor

Proposed Changes

Simple small change to change it to a struct. Avoids allocation.

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

I've let resharper implement the equality members, which also changed the GetHashCode. But as the type is internal, this is not breaking.

Comment on lines 101 to 104
unchecked
{
return (Major * 397) ^ Minor;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
unchecked
{
return (Major * 397) ^ Minor;
}
return (Major, Minor).GetHashCode();

Copy link
Member

Choose a reason for hiding this comment

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

That seems to require an extra dependency on System.Tuple_2, though.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the suggestion, it is definitely a nicer option but I'm not sure if it's worth an extra dependency (if it does require one, I'm unable to compile this on .NET Core 3.1 on MacOS as is).

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to .NET 4.6.1 this syntax isn't yet possible to use without additional dependencies. (Similar to that we can't use anonymous (int, int) return values)

@michaelklishin michaelklishin merged commit f722b96 into rabbitmq:master Aug 19, 2020
@bollhals bollhals deleted the amqpVersion branch March 2, 2021 20:49
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