Perhaps this could be factored out into a struct Plural(&'static str, usize); ...and then println!("{len} patch{}", Plural("es", len)).
This would require casting a couple of sites, e.g. Plural("s", len as usize). It would also not be a fully-general pluralization support, e.g. println!("{} loa{}", len, if len == 1 { "f" } else { "ves" }) wouldn't work. So I think it's on the borderline of being a too-abstract solution for the given problem.
This would require casting a couple of sites, e.g.
Plural("s", len as usize)
. It would also not be a fully-general pluralization support, e.g.println!("{} loa{}", len, if len == 1 { "f" } else { "ves" })
wouldn't work. So I think it's on the borderline of being a too-abstract solution for the given problem.