Format a count with singular/plural suffix. # Arguments `count` - The count to format `singular` - The singular form of the word # Returns A formatted string like "1 change" or "5 changes". # Example ```rust,ignore assert_eq!(format_count(1, "change"), "1 change"); assert_eq!(format_count(5, "change"), "5 changes"); ```
(count: usize, singular: &str)
| 555 | /// assert_eq!(format_count(5, "change"), "5 changes"); |
| 556 | /// ``` |
| 557 | pub fn format_count(count: usize, singular: &str) -> String { |
| 558 | if count == 1 { |
| 559 | format!("{} {}", count, singular) |
| 560 | } else { |
| 561 | format!("{} {}s", count, singular) |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | // ============================================================================= |
| 566 | // Tests |
nothing calls this directly
no outgoing calls
no test coverage detected