mirror of
https://github.com/noib3/nvim-oxi.git
synced 2025-08-04 19:08:31 +00:00
macros(test): avoid allocating new TokenStream
to represent attrs
This commit is contained in:
parent
494a1c777f
commit
f60b78ee7b
1 changed files with 1 additions and 6 deletions
|
@ -20,11 +20,6 @@ pub fn test(attrs: TokenStream, item: TokenStream) -> TokenStream {
|
|||
path.segments.iter().any(|segment| segment.ident == "should_panic")
|
||||
});
|
||||
|
||||
let test_attrs = test_attrs
|
||||
.into_iter()
|
||||
.map(ToTokens::into_token_stream)
|
||||
.collect::<proc_macro2::TokenStream>();
|
||||
|
||||
let test_name = sig.ident;
|
||||
|
||||
let test_ret = if should_panic {
|
||||
|
@ -76,7 +71,7 @@ pub fn test(attrs: TokenStream, item: TokenStream) -> TokenStream {
|
|||
|
||||
quote! {
|
||||
#[test]
|
||||
#test_attrs
|
||||
#(#test_attrs)*
|
||||
fn #test_name() #test_ret {
|
||||
#maybe_ignore_err #nvim_oxi::tests::test_macro::test_body(
|
||||
env!("CARGO_MANIFEST_PATH"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue