The implementation of the method Refinement.to_inner() has two problems:
It implicitly performs a (potentially expensive) self.clone(), and
It provides a clone of the stored value.
Currently, the documentation of the method says:
Retrieve the underlying value without consuming self.
First, the returned value is not the underlying value, but a clone of that value.
Second, the inner value is cloned, without any indication of that happening, neither in the name nor in the documentation.
I suggest renaming the method to clone_inner(), and changing the documentation to:
Returns a clone of the underlying value without consuming self.
The implementation of the method
Refinement.to_inner()
has two problems:self.clone()
, andCurrently, the documentation of the method says:
First, the returned value is not the underlying value, but a clone of that value. Second, the inner value is cloned, without any indication of that happening, neither in the name nor in the documentation.
I suggest renaming the method to
clone_inner()
, and changing the documentation to: