From 54e78d9ea36a1e61574b6df174695abdc95bc352 Mon Sep 17 00:00:00 2001
From: overlookmotel <557937+overlookmotel@users.noreply.github.com>
Date: Mon, 28 Oct 2024 00:47:45 +0000
Subject: [PATCH] refactor(ast_tools): reduce macro usage (#6956)
Pure refactor. Expand simple macros.
---
tasks/ast_tools/src/generators/ast_builder.rs | 36 ++++--------------
tasks/ast_tools/src/rust_ast.rs | 38 +++++++++----------
tasks/ast_tools/src/schema/defs.rs | 27 ++++++++++---
tasks/ast_tools/src/schema/get_generics.rs | 10 ++---
tasks/ast_tools/src/schema/get_ident.rs | 10 ++---
tasks/ast_tools/src/schema/mod.rs | 11 ------
tasks/ast_tools/src/schema/to_type.rs | 14 +++----
7 files changed, 64 insertions(+), 82 deletions(-)
diff --git a/tasks/ast_tools/src/generators/ast_builder.rs b/tasks/ast_tools/src/generators/ast_builder.rs
index b2e2d2116a6a2..3cfa71f78e841 100644
--- a/tasks/ast_tools/src/generators/ast_builder.rs
+++ b/tasks/ast_tools/src/generators/ast_builder.rs
@@ -2,10 +2,8 @@ use std::{borrow::Cow, stringify};
use convert_case::{Case, Casing};
use itertools::Itertools;
-use lazy_static::lazy_static;
use proc_macro2::TokenStream;
use quote::{format_ident, quote, ToTokens};
-use rustc_hash::FxHashMap;
use syn::{parse_quote, Ident, Type};
use crate::{
@@ -231,25 +229,13 @@ fn generate_enum_from_variant_builder_fn(
}
fn default_init_field(field: &FieldDef) -> bool {
- macro_rules! field {
- ($ident:ident: $ty:ty) => {
- (stringify!($ident), stringify!($ty))
- };
- }
- lazy_static! {
- static ref DEFAULT_FIELDS: FxHashMap<&'static str, &'static str> = FxHashMap::from_iter([
- field!(scope_id: Cell