Skip to content

const fn wherever possible #546

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 2 commits into from
Nov 16, 2022
Merged

Conversation

phip1611
Copy link
Member

@phip1611 phip1611 commented Nov 2, 2022

This is a follow-up to #545. It adds const fn everywhere possible.

We need to keep in mind that future refactorings might need to drop the const. This is considered fine as we do not require things to be const. In our case, it mainly helps to know if there will be side effects or not.

Checklist

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

@@ -26,6 +26,7 @@ impl<Data: Debug> Error<Data> {
}

/// Split this error into its inner status and error data
#[allow(clippy::missing_const_for_fn)]
Copy link
Member Author

Choose a reason for hiding this comment

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

clippy mistakenly thinks this can be const

@nicholasbishop
Copy link
Member

Looks like a few of these can't be const yet with our current msrv

@phip1611
Copy link
Member Author

phip1611 commented Nov 14, 2022

Looks like a few of these can't be const yet with our current msrv

I updated the PR. MSRV bump should no longer be required.

@nicholasbishop nicholasbishop merged commit 54c7818 into rust-osdev:main Nov 16, 2022
@phip1611 phip1611 deleted the const-fncs-2 branch November 21, 2022 08:33
@phip1611 phip1611 mentioned this pull request Jul 30, 2024
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.

3 participants