diff --git a/include/fmt/os.h b/include/fmt/os.h index b64f8bbf..960a66eb 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -247,10 +247,8 @@ class buffered_file { other.file_ = nullptr; } - buffered_file& operator=(buffered_file&& other) { - close(); - file_ = other.file_; - other.file_ = nullptr; + buffered_file& operator=(buffered_file&& other) FMT_NOEXCEPT { + std::swap(file_, other.file_); return *this; }