Skip to content

const fn for trivial getters where possible #545

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

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

phip1611
Copy link
Member

@phip1611 phip1611 commented Nov 2, 2022

This adds const to all trivial getters where possible. Although applications in the field will barely benefit from this, I like about const that it ensures that a function is pure, i.e., has no side-effects during runtime.

I did this with the help of cargo clippy -- -D clippy::missing_const_for_fn.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@nicholasbishop nicholasbishop merged commit 21c40d6 into rust-osdev:main Nov 2, 2022
@phip1611 phip1611 deleted the const-fncs branch November 2, 2022 17:08
@phip1611
Copy link
Member Author

phip1611 commented Nov 2, 2022

Yiikes.. Somehow the commit message is broken. I'm sorry for that. I don't know how that happened.. should have been a sensible description @nicholasbishop

@nicholasbishop
Copy link
Member

Oops, I didn't notice either :) Not a big deal anyway, it's pretty clear what's going on in that commit.

@phip1611 phip1611 restored the const-fncs branch November 2, 2022 17:11
@phip1611 phip1611 deleted the const-fncs branch November 2, 2022 17:11
@phip1611 phip1611 mentioned this pull request Nov 2, 2022
2 tasks
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.

2 participants