(ty: &syn::Type)
| 428 | } |
| 429 | |
| 430 | fn is_map(ty: &syn::Type) -> bool { |
| 431 | if let Some(ty) = try_extract_option(ty) { |
| 432 | return is_map(ty); |
| 433 | } |
| 434 | |
| 435 | let syn::Type::Path(p) = ty else { |
| 436 | return false; |
| 437 | }; |
| 438 | |
| 439 | // Always check the last arg such as in `std::vec::Vec` |
| 440 | let Some(seg) = p.path.segments.last() else { |
| 441 | return false; |
| 442 | }; |
| 443 | |
| 444 | seg.ident == "HashMap" || seg.ident == "BTreeMap" || seg.ident == "IndexMap" |
| 445 | } |
| 446 | |
| 447 | fn try_extract_option(ty: &syn::Type) -> Option<&syn::Type> { |
| 448 | let syn::Type::Path(p) = ty else { |
no test coverage detected