Skip to content

Conversation

@stevefan1999-personal
Copy link

No description provided.

@stevefan1999-personal stevefan1999-personal marked this pull request as ready for review September 25, 2023 05:41
t.elems.last().unwrap().into_token_stream(),
);
let (lit, base) = (
syn::parse::<LitStr>(lit.into())?,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why parse again instead of just checking if let Expr::Let(litlit) = lit and let Lit::Str(litstr) = &litlit.lit?

}

fn inner(ts: TokenStream, utf8: bool) -> Result<impl Into<TokenStream>> {
if let Ok(t) = syn::parse::<ExprTuple>(ts.clone()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about actually using a custom Parse implementation

}

fn inner(ts: TokenStream, utf8: bool) -> Result<impl Into<TokenStream>> {
if let Ok(t) = syn::parse::<ExprTuple>(ts.clone()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why tuple? The invocation will then become deflate_file!(("file.gz", "base")) with double parentheses.

syn::parse::<LitStr>(lit.into())?,
syn::parse::<LitStr>(base.into())?,
);
let key = quote!(#base).to_string();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just get base.value()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants