133 | let v = b"3q2+7w==".iter().cloned().collect();
| ^
| |
| consider giving `v` a type
| cannot infer type for `_`
If I change to:
let v: Vec<u8> = b"3q2+7w==".iter().cloned().collect();
The program compiles without problems. If cloned() returns an object that implements Iterator<Item=u8> then collect() should return a Vec<u8>, yet the compiler seems to require type information. Am I missing something obvious?
You can collect into any type that implements FromIterator so it’s ambiguous if type inference can’t deduce it. Vec is just one type that implements FromIterator but there can be arbitrary other options.