Closed
Description
This is the code:
use std::hashmap;
fn main() {
let mut map = hashmap::HashMap::new();
let str = "Hello, world!";
for &char in str.to_ascii().iter() {
let count = map.find(&char);
match count {
Some(&x) => map.insert(char, x + 1),
None => map.insert(char, 1)
}
}
println!("{:?}", map);
}
Error message:
count_chars.rs:11:41: 11:42 error: the type of this value must be known in this context
count_chars.rs:11 Some(&x) => map.insert(char, x + 1),
^
error: aborting due to previous error