From 58a06b6a9986149937d7efa97eba83df207a1c7c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 6 May 2024 13:51:15 +1000 Subject: Remove `enum_from_u32`. It's a macro that just creates an enum with a `from_u32` method. It has two arms. One is unused and the other has a single use. This commit inlines that single use and removes the whole macro. This increases readability because we don't have two different macros interacting (`enum_from_u32` and `language_item_table`). --- compiler/rustc_data_structures/src/lib.rs | 1 - compiler/rustc_data_structures/src/macros.rs | 37 ---------------------------- 2 files changed, 38 deletions(-) delete mode 100644 compiler/rustc_data_structures/src/macros.rs (limited to 'compiler/rustc_data_structures/src') diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 407ee0453e5..85b5a3cdb7c 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -62,7 +62,6 @@ pub mod fx; pub mod graph; pub mod intern; pub mod jobserver; -pub mod macros; pub mod marker; pub mod memmap; pub mod obligation_forest; diff --git a/compiler/rustc_data_structures/src/macros.rs b/compiler/rustc_data_structures/src/macros.rs deleted file mode 100644 index e05491f6ff6..00000000000 --- a/compiler/rustc_data_structures/src/macros.rs +++ /dev/null @@ -1,37 +0,0 @@ -#[macro_export] -macro_rules! enum_from_u32 { - ($(#[$attr:meta])* pub enum $name:ident { - $($(#[$var_attr:meta])* $variant:ident = $e:expr,)* - }) => { - $(#[$attr])* - pub enum $name { - $($(#[$var_attr])* $variant = $e),* - } - - impl $name { - pub fn from_u32(u: u32) -> Option<$name> { - $(if u == $name::$variant as u32 { - return Some($name::$variant) - })* - None - } - } - }; - ($(#[$attr:meta])* pub enum $name:ident { - $($(#[$var_attr:meta])* $variant:ident,)* - }) => { - $(#[$attr])* - pub enum $name { - $($(#[$var_attr])* $variant,)* - } - - impl $name { - pub fn from_u32(u: u32) -> Option<$name> { - $(if u == $name::$variant as u32 { - return Some($name::$variant) - })* - None - } - } - } -} -- cgit 1.4.1-3-g733a5