Distinct explicit dependency units, not a type-resolved coupling metric.
(node: Node<'_>, source: &str, result: &mut BTreeSet<String>)
| 475 | |
| 476 | /// Distinct explicit dependency units, not a type-resolved coupling metric. |
| 477 | fn rust_roots(node: Node<'_>, source: &str, result: &mut BTreeSet<String>) { |
| 478 | if node.kind() == "use_list" { |
| 479 | for child in named(node) { |
| 480 | rust_roots(child, source, result); |
| 481 | } |
| 482 | } else if node.kind() == "use_as_clause" { |
| 483 | if let Some(path) = node.child_by_field_name("path") { |
| 484 | rust_roots(path, source, result); |
| 485 | } |
| 486 | } else { |
| 487 | let path = node.child_by_field_name("path").unwrap_or(node); |
| 488 | let root = text(path, source) |
| 489 | .trim_start_matches("::") |
| 490 | .split("::") |
| 491 | .next() |
| 492 | .unwrap_or_default() |
| 493 | .trim(); |
| 494 | if !root.is_empty() { |
| 495 | result.insert(root.into()); |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | fn rust_bindings(node: Node<'_>, source: &str, prefix: Option<&str>, result: &mut Vec<String>) { |
| 501 | match node.kind() { |