-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add some convenience helper methods on hir::Safety
#134285
base: master
Are you sure you want to change the base?
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE machinery cc @rust-lang/wg-const-eval |
The job Click to see the possible cause of the failure (guessed by this bot)
|
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.
r=me when green
@@ -3401,6 +3401,17 @@ impl Safety { | |||
Self::Safe => "", | |||
} | |||
} | |||
|
|||
pub fn is_unsafe(self) -> bool { |
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.
nit:
pub fn is_unsafe(self) -> bool { | |
#[inline] | |
pub fn is_unsafe(self) -> bool { |
!self.is_safe() | ||
} | ||
|
||
pub fn is_safe(self) -> bool { |
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.
nit:
pub fn is_safe(self) -> bool { | |
#[inline] | |
pub fn is_safe(self) -> bool { |
Makes a lot of call sites simpler and should make any refactorings needed for #134090 (comment) simpler, as fewer sites have to be touched in case we end up storing some information in the variants of
hir::Safety