-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow user input environmental variables as base path #21
base: master
Are you sure you want to change the base?
Allow user input environmental variables as base path #21
Conversation
t.elems.last().unwrap().into_token_stream(), | ||
); | ||
let (lit, base) = ( | ||
syn::parse::<LitStr>(lit.into())?, |
There was a problem hiding this comment.
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
?
@@ -67,20 +67,42 @@ pub fn deflate_utf8_file(ts: TokenStream) -> TokenStream { | |||
} | |||
|
|||
fn inner(ts: TokenStream, utf8: bool) -> Result<impl Into<TokenStream>> { | |||
if let Ok(t) = syn::parse::<ExprTuple>(ts.clone()) { |
There was a problem hiding this comment.
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
@@ -67,20 +67,42 @@ pub fn deflate_utf8_file(ts: TokenStream) -> TokenStream { | |||
} | |||
|
|||
fn inner(ts: TokenStream, utf8: bool) -> Result<impl Into<TokenStream>> { | |||
if let Ok(t) = syn::parse::<ExprTuple>(ts.clone()) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()
?
No description provided.