From ca385cadd9eceb2d4687f896401e14942e0ca9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Fri, 4 Apr 2025 13:46:35 +0200 Subject: [PATCH] Ignore clang's self-assignment check As-documented in the code, this is already safe so ignore the false-positive. Original author: Cory Fields --- include/leveldb/status.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/leveldb/status.h b/include/leveldb/status.h index e3273144e4..68efe3001a 100644 --- a/include/leveldb/status.h +++ b/include/leveldb/status.h @@ -103,6 +103,8 @@ class LEVELDB_EXPORT Status { inline Status::Status(const Status& rhs) { state_ = (rhs.state_ == nullptr) ? nullptr : CopyState(rhs.state_); } + +// NOLINTBEGIN(bugprone-unhandled-self-assignment) inline Status& Status::operator=(const Status& rhs) { // The following condition catches both aliasing (when this == &rhs), // and the common case where both rhs and *this are ok. @@ -112,6 +114,8 @@ inline Status& Status::operator=(const Status& rhs) { } return *this; } +// NOLINTEND(bugprone-unhandled-self-assignment) + inline Status& Status::operator=(Status&& rhs) noexcept { std::swap(state_, rhs.state_); return *this;