diff --git a/exercises/conversions/as_ref_mut.rs b/exercises/conversions/as_ref_mut.rs index 8a907031..5e80e508 100644 --- a/exercises/conversions/as_ref_mut.rs +++ b/exercises/conversions/as_ref_mut.rs @@ -13,7 +13,7 @@ fn byte_counter(arg: T) -> usize { // Obtain the number of characters (not bytes) in the given argument // Add the AsRef trait appropriately as a trait bound fn char_counter(arg: T) -> usize { - arg.as_ref().chars().collect::>().len() + arg.as_ref().chars().count() } fn main() { @@ -31,8 +31,10 @@ mod tests { let s = "Café au lait"; assert_ne!(char_counter(s), byte_counter(s)); } + + #[test] fn same_counts() { let s = "Cafe au lait"; assert_eq!(char_counter(s), byte_counter(s)); } -} \ No newline at end of file +}