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

Use const functions where possible #684

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

richardpringle
Copy link
Contributor

I just used clippy for this. I actually assume that you will not want the brunt of this change but I figured it was easier to make the change everywhere then simply pick the ones you deem acceptable (if any).

I definitey think some of the constructors should be const.

Thanks in advance!

@VictorKoenders
Copy link
Contributor

Looks good to me.

Out of pure interest, can you check if this actually improves any of the benchmarks?

Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ff7a45a) 57.24% compared to head (4a77a75) 57.24%.

Files Patch % Lines
src/error.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk     #684   +/-   ##
=======================================
  Coverage   57.24%   57.24%           
=======================================
  Files          51       51           
  Lines        4350     4350           
=======================================
  Hits         2490     2490           
  Misses       1860     1860           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@VictorKoenders VictorKoenders merged commit 3a638a7 into bincode-org:trunk Dec 14, 2023
74 checks passed
@richardpringle
Copy link
Contributor Author

Looks good to me.

Out of pure interest, can you check if this actually improves any of the benchmarks?

I'm not quite sure I understand what you're asking. const shouldn't change the behaviour at all, it will only make those functions available in const context. In order to improve a benchmark, you would have to change the code at the call-site.

You should also be aware that removing const from a pub const function is a breaking change. Given the extensive use of the builder-pattern, this shouldn't be a concern, though.

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.

None yet

2 participants