Ignore syn::Type::Group in is_python

This commit is contained in:
scalexm 2021-03-18 18:54:35 +01:00
parent 20452a7c09
commit adc6e6fe4e

View file

@ -27,7 +27,11 @@ macro_rules! ensure_spanned {
}
/// Check if the given type `ty` is `pyo3::Python`.
pub fn is_python(ty: &syn::Type) -> bool {
pub fn is_python(mut ty: &syn::Type) -> bool {
while let syn::Type::Group(group) = ty {
// Macros can create invisible delimiters around types.
ty = &*group.elem;
}
match ty {
syn::Type::Path(typath) => typath
.path