From 6c084072ad3916e2270117dad64cd3a84a14f5f4 Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Tue, 19 Dec 2023 15:25:00 -0800 Subject: [PATCH] remove macros crate (#110) The macros crate is no-longer required and should be removed. --- Cargo.lock | 10 ---------- Cargo.toml | 1 - src/common/Cargo.toml | 1 - src/common/src/metrics.rs | 3 --- src/macros/Cargo.toml | 18 ------------------ src/macros/src/lib.rs | 25 ------------------------- 6 files changed, 58 deletions(-) delete mode 100644 src/macros/Cargo.toml delete mode 100644 src/macros/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index ebdaecbf..b6a7708c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -579,7 +579,6 @@ version = "0.3.1" dependencies = [ "boring", "clocksource", - "macros", "metriken", "net", "ringlog", @@ -1358,15 +1357,6 @@ dependencies = [ "libc", ] -[[package]] -name = "macros" -version = "0.3.1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "matchit" version = "0.7.0" diff --git a/Cargo.toml b/Cargo.toml index b9469379..a0a0b9b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ members = [ "src/core/server", "src/entrystore", "src/logger", - "src/macros", "src/net", "src/protocol/admin", "src/protocol/common", diff --git a/src/common/Cargo.toml b/src/common/Cargo.toml index b5063c29..b98ac190 100644 --- a/src/common/Cargo.toml +++ b/src/common/Cargo.toml @@ -12,7 +12,6 @@ license = { workspace = true } [dependencies] boring = { workspace = true } clocksource = { workspace = true } -macros = { path = "../macros" } metriken = { workspace = true } net = { path = "../net" } ringlog = { workspace = true } diff --git a/src/common/src/metrics.rs b/src/common/src/metrics.rs index ad780b3b..73e784ba 100644 --- a/src/common/src/metrics.rs +++ b/src/common/src/metrics.rs @@ -1,8 +1,5 @@ use metriken::*; -#[doc(hidden)] -pub use macros::to_lowercase; - /// Creates a test that verifies that no two metrics have the same name. #[macro_export] #[rustfmt::skip] diff --git a/src/macros/Cargo.toml b/src/macros/Cargo.toml deleted file mode 100644 index fb3b4928..00000000 --- a/src/macros/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "macros" -description = "Utility macros for use within pelikan" -authors = ["Sean Lynch "] - -version = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -repository = { workspace = true } -license = { workspace = true } - -[lib] -proc-macro = true - -[dependencies] -quote = { workspace = true } -syn = { workspace = true } -proc-macro2 = { workspace = true } diff --git a/src/macros/src/lib.rs b/src/macros/src/lib.rs deleted file mode 100644 index 0036c727..00000000 --- a/src/macros/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Twitter, Inc. -// Licensed under the Apache License, Version 2.0 -// http://www.apache.org/licenses/LICENSE-2.0 - -//! A collection of macros which are used by other crates within Pelikan. - -use proc_macro::TokenStream; -use quote::quote; -use syn::Ident; - -/// This macro statically converts an ident to a lowercased string -/// at compile time. -/// -/// In the future this could be replaced with some const code. However, -/// `std::str::from_utf8_unchecked` is not stably const just yet so we -/// need this macro as a workaround. -#[proc_macro] -pub fn to_lowercase(input: TokenStream) -> TokenStream { - let ident = syn::parse_macro_input!(input as Ident); - let name = ident.to_string().to_ascii_lowercase(); - let literal = syn::LitStr::new(&name, ident.span()); - let tokens = quote! { #literal }; - - tokens.into() -}