-
Notifications
You must be signed in to change notification settings - Fork 1.8k
assertions_on_constants
: Suggest using a const block when using a named constant
#15774
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
Conversation
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
This comment has been minimized.
This comment has been minimized.
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Lintcheck changes for 61b1f0e
This comment will be updated if you push new changes |
b51b811
to
2d24b01
Compare
This now comes before #15773. |
if self.msrv.meets(cx, msrvs::CONST_PANIC) { | ||
( | ||
"this assertion has a constant value", | ||
"consider moving this to an anonymous constant: `const _: () = { assert!(..); }`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not suggest a const
block instead? const { assert!(..); }
seems more readable than an unnamed unit constant. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot those are stable.
r? samueltardieu because of #15773 |
…-local constants.
Thanks. |
changelog: [
assertions_on_constants
]: Suggest using a const block when the assertion uses a named constant.