Skip to content

Commit

Permalink
Merge pull request #27 from audunhalland/remove-proc-macro-hack
Browse files Browse the repository at this point in the history
Remove proc_macro_hack dependency
  • Loading branch information
tkaitchuck authored Oct 23, 2023
2 parents 1a6acab + 4ef07e2 commit 8d01e50
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ edition = "2018"

[dependencies]
const-random-macro = { path = "macro", version = "0.1.15"}
proc-macro-hack = { version = "0.5" }
1 change: 0 additions & 1 deletion macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ edition = "2018"
proc-macro = true

[dependencies]
proc-macro-hack = { version = "0.5.13" }
getrandom = "0.2.0"
tiny-keccak = { version = "2.0.2", features = ["shake"] }
once_cell = { version = "1.15", default-features = false, features = ["race", "alloc"] }
3 changes: 1 addition & 2 deletions macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
extern crate proc_macro;

use proc_macro::*;
use proc_macro_hack::proc_macro_hack;
use std::iter::once;
mod span;
use crate::span::{gen_random_bytes, gen_random};
Expand All @@ -13,7 +12,7 @@ fn ident(ident: &str) -> TokenStream {
TokenTree::from(Ident::new(ident, Span::call_site())).into()
}

#[proc_macro_hack]
#[proc_macro]
pub fn const_random(input: TokenStream) -> TokenStream {
match &input.to_string()[..] {
"u8" => TokenTree::from(Literal::u8_suffixed(gen_random())).into(),
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![no_std]
use proc_macro_hack::proc_macro_hack;

/// # Random constants
/// Allows you to insert random constants into your code that will be auto-generated at compile time.
/// A new value will be generated every time the relevent file is re-built.
Expand All @@ -12,5 +9,4 @@ use proc_macro_hack::proc_macro_hack;
/// ```
///
/// The following types are supported u8, i8, u16, i16, u32, i32, u64, i64, u128, i128, usize, isize and [u8; N].
#[proc_macro_hack(fake_call_site)]
pub use const_random_macro::const_random;

0 comments on commit 8d01e50

Please sign in to comment.