Format a count with singular/plural suffix. # Example ```rust,ignore assert_eq!(format_count(1, "change"), "1 change"); assert_eq!(format_count(5, "change"), "5 changes"); ```
(count: usize, singular: &str)
| 485 | /// assert_eq!(format_count(5, "change"), "5 changes"); |
| 486 | /// ``` |
| 487 | pub fn format_count(count: usize, singular: &str) -> String { |
| 488 | if count == 1 { |
| 489 | format!("{} {}", count, singular) |
| 490 | } else { |
| 491 | format!("{} {}s", count, singular) |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | // Tests |
| 496 |
nothing calls this directly
no outgoing calls
no test coverage detected