Heuristic: does a path segment look like an opaque identifier?
(segment: &str)
| 400 | |
| 401 | /// Heuristic: does a path segment look like an opaque identifier? |
| 402 | fn looks_like_id(segment: &str) -> bool { |
| 403 | if segment.is_empty() { |
| 404 | return false; |
| 405 | } |
| 406 | // Pure numeric |
| 407 | if segment.chars().all(|c| c.is_ascii_digit()) && segment.len() >= 2 { |
| 408 | return true; |
| 409 | } |
| 410 | // UUID-ish (contains dashes, 32+ hex chars) |
| 411 | let hex_only: String = segment.chars().filter(char::is_ascii_hexdigit).collect(); |
| 412 | if hex_only.len() >= 24 && segment.contains('-') { |
| 413 | return true; |
| 414 | } |
| 415 | // Long hex string (hash, token) |
| 416 | if hex_only.len() >= 16 && segment.len() == hex_only.len() { |
| 417 | return true; |
| 418 | } |
| 419 | false |
| 420 | } |
| 421 | |
| 422 | /// Extract just the binary name from a full path. |
| 423 | fn short_binary_name(path: &str) -> String { |
no test coverage detected