From 5863d7f067d5a61b3275cff0410cf5818d41bfd7 Mon Sep 17 00:00:00 2001 From: Jerry Crunchtime Date: Sun, 12 Dec 2021 14:07:13 +0100 Subject: [PATCH] Make `buffered_file` move assignment `noexcept` --- include/fmt/os.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; }