Truncate a string for safe inclusion in error messages.
(s: &str)
| 1324 | |
| 1325 | /// Truncate a string for safe inclusion in error messages. |
| 1326 | fn truncate_for_display(s: &str) -> String { |
| 1327 | if s.len() <= 80 { |
| 1328 | s.to_string() |
| 1329 | } else { |
| 1330 | format!("{}...", &s[..77]) |
| 1331 | } |
| 1332 | } |
| 1333 | |
| 1334 | /// Normalize a filesystem path by collapsing redundant separators |
| 1335 | /// and removing trailing slashes, without requiring the path to exist on disk. |
no test coverage detected