How to avoid tail type hint of number literal when generate code with proc_macro2?

let n: u64 = 1;
println!("{}", quote!(#n));

The output is 1u64. How to output 1 directly?

You can use proc_macro2::Literal, specifically Literal::u64_unsuffixed(1).

How to convert Literal to TokenStream?


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.