Add comment explaining why we double-parse an Expr
This commit is contained in:
parent
bbedf130ce
commit
df00e2fd71
1 changed files with 1 additions and 0 deletions
|
@ -510,6 +510,7 @@ fn wrap_string_validation(v: Vec<TokenStream>) -> Option<TokenStream> {
|
|||
}
|
||||
|
||||
fn str_or_num_to_expr(cx: &Ctxt, meta_item_name: &str, expr: Expr) -> Option<Expr> {
|
||||
// this odd double-parsing is to make `-10` parsed as an Lit instead of an Expr::Unary
|
||||
let lit: Lit = match syn::parse2(expr.to_token_stream()) {
|
||||
Ok(l) => l,
|
||||
Err(err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue