-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update proc-macro2, syn and quote to 1.0 #608
Conversation
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.
Great, thanks for jumping on this! That's a bummer that the recursion limit didn't go down :/
syn::FnArg::Inferred(pat) => pat, | ||
_ => return Err(syn::Error::new_spanned(or_span, "invalid closure argument")), | ||
}; | ||
let var = inputs.first().unwrap(); |
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.
We actually can't handle all Pat
types. I think we only want to cover Pat::Ident
and Pat::Wild
. Here's a code snippet only handling Ident:
let var = match inputs.first().unwrap() {
Pat::Ident(ident) => Ok(ident),
_ => Err(syn::Error::new_spanned(or_span, "unsupported closure argument")),
}?;
@@ -149,7 +148,7 @@ impl PropField { | |||
_ => None, | |||
})?; | |||
|
|||
if meta_list.ident == "props" { | |||
if meta_list.path.get_ident().map(|ident| ident.to_string()) == Some("props".to_owned()) { |
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.
How about trying to avoid the to_owned
allocation and use a helper fn like this:
fn match_path(path: &Path, id_str: &str) -> bool {
if let Some(ident) = path.get_ident() {
ident == id_str
} else {
false
}
}
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.
I just found Path::is_ident()
, which does that
In order to fix the macro tests you will have to follow these steps:
|
005f7bc
to
c97d23c
Compare
@jstarry Thanks for the feedback! Ready for review again. |
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.
Looks great! Good find with is_ident
:)
bors r+ |
Build succeeded
|
CLOSES #590
I also tried to lift the recursion limits in the examples, but it looks like they are still required (maybe due to macros from stdweb?).