For T:Clone, idiomatic way to go from Option<&T> to Option<T>?

#1
  1. For T: Clone, what is the idiomatic way t ogo from Option<&T> to Option<T> ?
#2

I suggest o.map(|ref t| t.clone())

1 Like
#3

There’s .cloned() on options and iterators.

7 Likes