Format a count with proper pluralization. # Arguments `count` - The number of items `singular` - The singular form of the word (e.g., "change") # Returns A string like "1 change" or "5 changes". # Example ```rust use atomic::commands::pull::helpers::format_count; assert_eq!(format_count(0, "change"), "0 changes"); assert_eq!(format_count(1, "change"), "1 change"); assert_eq!(format_count(5,
(count: usize, singular: &str)
| 411 | /// assert_eq!(format_count(5, "change"), "5 changes"); |
| 412 | /// ``` |
| 413 | pub fn format_count(count: usize, singular: &str) -> String { |
| 414 | if count == 1 { |
| 415 | format!("{} {}", count, singular) |
| 416 | } else { |
| 417 | format!("{} {}s", count, singular) |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /// Format bytes in a human-readable way. |
| 422 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected