me: ...unwrap_or_default();

rustc: trait Default is not implemented for &u64, only for u64 !

me: ...map(|x| *x);

rustc: omg I have no idea what you are talking about, please add type annotations!!

🤦 #rust #rustlang

@matthiaskrgr

not sure if it is the desired logic:

```rust
fn main() {
let x = 10u64;

let y = Some(&x);
// let y: Option<&u64> = None;
dbg!(&y);

let a = y.copied().unwrap_or_default();
dbg!(&a);
}

```

https://doc.rust-lang.org/std/option/enum.Option.html#method.copied

Option in std::option - Rust

The `Option` type. See the module level documentation for more.

@matthiaskrgr

The compiler is a bit dumb like that sometimes :)

Though, I'm mostly here to tell you about .cloned().

I just saw your post, and I think that's exactly, what map(|x| *x) is trying to do ^^