From the docs of unique_ptr‘s operator=:
Transfers ownership of the object pointed to by r to *this as if by calling
reset(r.release())followed by an assignment fromstd::forward<E>(r.get_deleter()).
And all you need of that is the reset call, so it’s simpler to just call it directly