(ty: &syn::Type)
| 402 | } |
| 403 | |
| 404 | fn is_list(ty: &syn::Type) -> bool { |
| 405 | if let Some(ty) = try_extract_option(ty) { |
| 406 | return is_list(ty); |
| 407 | } |
| 408 | |
| 409 | // We consider arrays lists |
| 410 | if let syn::Type::Array(_) = ty { |
| 411 | return true; |
| 412 | } |
| 413 | |
| 414 | // If it's not a path, it's not a list |
| 415 | let syn::Type::Path(p) = ty else { |
| 416 | return false; |
| 417 | }; |
| 418 | |
| 419 | // Always check the last arg such as in `std::vec::Vec` |
| 420 | let Some(seg) = p.path.segments.last() else { |
| 421 | return false; |
| 422 | }; |
| 423 | |
| 424 | seg.ident == "Vec" |
| 425 | || seg.ident == "HashSet" |
| 426 | || seg.ident == "BTreeSet" |
| 427 | || seg.ident == "IndexSet" |
| 428 | } |
| 429 | |
| 430 | fn is_map(ty: &syn::Type) -> bool { |
| 431 | if let Some(ty) = try_extract_option(ty) { |
no test coverage detected