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

clippy: add use_self and const fn #1271

Merged
merged 3 commits into from
Jul 31, 2024
Merged

clippy: add use_self and const fn #1271

merged 3 commits into from
Jul 31, 2024

Conversation

phip1611
Copy link
Member

Follow-up of #546, which adds const to more functions, adds it as mandatory lint, and also uses Self where possible.

Checklist

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

@phip1611 phip1611 force-pushed the clippy branch 4 times, most recently from dc74b95 to e49fb4f Compare July 30, 2024 07:32
@phip1611 phip1611 requested a review from nicholasbishop July 30, 2024 15:13
@phip1611 phip1611 force-pushed the clippy branch 2 times, most recently from 70e1393 to 7164113 Compare July 30, 2024 15:17
phip1611 added 3 commits July 31, 2024 10:57

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
This has the benefit that users clearly see that no side effects can happen.
However, the public API changes in the sense that once we remove const for a
function, user code might break.

Nevertheless, this is a code improvement, IMHO.

Regarding the device path code, which is generated: So far the simplest solution
is to deactivate this lint there. It is not trivial to decide which function can
be const and which not during code generation. It is future work to solve this,
if necessary.
@phip1611 phip1611 added this pull request to the merge queue Jul 31, 2024
Merged via the queue into rust-osdev:main with commit 7d61816 Jul 31, 2024
12 checks passed
@phip1611 phip1611 deleted the clippy branch July 31, 2024 09:07
@phip1611 phip1611 mentioned this pull request Jul 31, 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.

None yet

2 participants