1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-25 01:16:12 +02:00

Remove redundant trait bounds from counter exercise (#1980)

The trait bounds aren't needed on the struct definition, only the impl
block. I think it'd be useful to show the difference here in order to
show students how trait bounds for collection types are usually on the
impl blocks rather than the type itself.
This commit is contained in:
Nicole L 2024-04-12 14:07:08 -07:00 committed by GitHub
parent b808887006
commit a4d674b02e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,7 @@ use std::collections::HashMap;
use std::hash::Hash;
/// Counter counts the number of times each value of type T has been seen.
struct Counter<T: Eq + Hash> {
struct Counter<T> {
values: HashMap<T, u64>,
}