Split declare_features!
.
It's a macro with four clauses, three of which are doing one thing, and the fourth is doing something completely different. This commit splits it into two macros, which is more sensible.
This commit is contained in:
parent
043a9873b9
commit
3c1b60c1b4
@ -14,16 +14,19 @@ enum FeatureStatus {
|
||||
Internal,
|
||||
}
|
||||
|
||||
macro_rules! declare_features {
|
||||
(__status_to_enum active) => {
|
||||
macro_rules! status_to_enum {
|
||||
(active) => {
|
||||
FeatureStatus::Default
|
||||
};
|
||||
(__status_to_enum incomplete) => {
|
||||
(incomplete) => {
|
||||
FeatureStatus::Incomplete
|
||||
};
|
||||
(__status_to_enum internal) => {
|
||||
(internal) => {
|
||||
FeatureStatus::Internal
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! declare_features {
|
||||
($(
|
||||
$(#[doc = $doc:tt])* ($status:ident, $feature:ident, $ver:expr, $issue:expr, $edition:expr),
|
||||
)+) => {
|
||||
@ -92,7 +95,7 @@ pub fn enabled(&self, feature: Symbol) -> bool {
|
||||
pub fn incomplete(&self, feature: Symbol) -> bool {
|
||||
match feature {
|
||||
$(
|
||||
sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Incomplete,
|
||||
sym::$feature => status_to_enum!($status) == FeatureStatus::Incomplete,
|
||||
)*
|
||||
// accepted and removed features aren't in this file but are never incomplete
|
||||
_ if self.declared_lang_features.iter().any(|f| f.0 == feature) => false,
|
||||
@ -107,7 +110,7 @@ pub fn incomplete(&self, feature: Symbol) -> bool {
|
||||
pub fn internal(&self, feature: Symbol) -> bool {
|
||||
match feature {
|
||||
$(
|
||||
sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Internal,
|
||||
sym::$feature => status_to_enum!($status) == FeatureStatus::Internal,
|
||||
)*
|
||||
// accepted and removed features aren't in this file but are never internal
|
||||
// (a removed feature might have been internal, but it doesn't matter anymore)
|
||||
|
Loading…
Reference in New Issue
Block a user