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

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

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

1 Like

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


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.