-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Extend Level API #121230
Extend Level API #121230
Conversation
rustbot has assigned @petrochenkov. Use r? to explicitly pick a reviewer |
This comment has been minimized.
This comment has been minimized.
8245e40
to
bcb8768
Compare
Fixed format. |
I'm on vacation. |
/// level as that would require a [`LintExpectationId`] | ||
pub fn from_str(x: &str) -> Option<Level> { | ||
/// level as that would require a [`LintExpectationId`]. | ||
pub fn from_str(x: &str) -> Option<Self> { |
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.
pub fn from_str(x: &str) -> Option<Self> { | |
pub fn from_str(x: &str) -> Option<Level> { |
sym::warn => Some(Level::Warn), | ||
sym::deny => Some(Level::Deny), | ||
sym::forbid => Some(Level::Forbid), | ||
pub fn from_attr(attr: &Attribute) -> Option<Self> { |
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.
pub fn from_attr(attr: &Attribute) -> Option<Self> { | |
pub fn from_attr(attr: &Attribute) -> Option<Level> { |
Self::from_symbol(attr.name_or_empty(), Some(attr.id)) | ||
} | ||
|
||
pub fn from_symbol(s: Symbol, id: Option<AttrId>) -> Option<Self> { |
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.
pub fn from_symbol(s: Symbol, id: Option<AttrId>) -> Option<Self> { | |
pub fn from_symbol(s: Symbol, id: Option<AttrId>) -> Option<Level> { |
bcb8768
to
c17539c
Compare
I have no opinion on |
@bors rollup=always |
@bors r=Nadrieril |
…=Nadrieril Extend Level API I need this API for rust-lang/rust-clippy#12303: I have a nested `cfg` attribute (so a `MetaItem`) and I'd like to still be able to match against all possible kind of `Level`s.
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#121067 (make "invalid fragment specifier" translatable) - rust-lang#121079 (distribute tool documentations and avoid file conflicts on `x install`) - rust-lang#121230 (Extend Level API) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`) r? `@ghost` `@rustbot` modify labels: rollup
…=Nadrieril Extend Level API I need this API for rust-lang/rust-clippy#12303: I have a nested `cfg` attribute (so a `MetaItem`) and I'd like to still be able to match against all possible kind of `Level`s.
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#119808 (Store core::str::CharSearcher::utf8_size as u8) - rust-lang#121032 (Continue reporting remaining errors instead of silently dropping them) - rust-lang#121041 (Add `Future` and `IntoFuture` to the 2024 prelude) - rust-lang#121230 (Extend Level API) - rust-lang#121272 (Add diagnostic items for legacy numeric constants) - rust-lang#121275 (add test for panicking attribute macros) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121230 - GuillaumeGomez:extend-level-api, r=Nadrieril Extend Level API I need this API for rust-lang/rust-clippy#12303: I have a nested `cfg` attribute (so a `MetaItem`) and I'd like to still be able to match against all possible kind of `Level`s.
Improve `is_lint_level` code Since rust-lang/rust#121230 was merged, we can now rely on `Level` directly instead of keeping the list of symbols to check in clippy. changelog: Improve `is_lint_level` code
Improve `is_lint_level` code Since rust-lang/rust#121230 was merged, we can now rely on `Level` directly instead of keeping the list of symbols to check in clippy. changelog: Improve `is_lint_level` code
I need this API for rust-lang/rust-clippy#12303: I have a nested
cfg
attribute (so aMetaItem
) and I'd like to still be able to match against all possible kind ofLevel
s.