(arr: &[Value])
| 622 | } |
| 623 | |
| 624 | fn compact_path_array(arr: &[Value]) -> Option<String> { |
| 625 | if arr.len() < 2 || !arr.iter().all(Value::is_string) { |
| 626 | return None; |
| 627 | } |
| 628 | let paths = arr.iter().filter_map(Value::as_str).collect::<Vec<_>>(); |
| 629 | if !paths.iter().all(|path| looks_like_path(path)) { |
| 630 | return None; |
| 631 | } |
| 632 | let bullets = paths |
| 633 | .iter() |
| 634 | .map(|path| format!("- {path}")) |
| 635 | .collect::<Vec<_>>() |
| 636 | .join("\n"); |
| 637 | let compact = format_compact_path_list(paths.iter().copied(), "- ", ""); |
| 638 | if compact == bullets { |
| 639 | None |
| 640 | } else { |
| 641 | Some(compact) |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | fn looks_like_path(value: &str) -> bool { |
| 646 | let trimmed = value.trim(); |
no test coverage detected