Below is an reduced example from my code that reads a directory, traverses over the files, and appends a comment to the end of each file...
This example shows a Vec<Option<bool>> that after calling iter() the compiler is interpreting the Option<_> as a borrow &Option<_> type. I'd like to understand why I'm seeing this behavior.
fn main() {
let vec = vec![Some(true), None];
vec.iter()
.filter_map(|o| o)
.count();
}
Compiler output
src/main.rs:50:25: 50:26 error: mismatched types:
expected `core::option::Option<_>`,
found `&core::option::Option<bool>`
(expected enum `core::option::Option`,
found &-ptr) [E0308]
src/main.rs:50 .filter_map(|o| o)