mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:27:35 +00:00
AK: Resolve clang-tidy warnings about unusual assignment operators
Either not returning *this, or in the case of Variant, not checking for self assignment. In AK::Atomic, we can't return *this due to the wrapper semantics Atomic implements.
This commit is contained in:
parent
22feb9d47b
commit
163367da39
3 changed files with 17 additions and 9 deletions
20
AK/Variant.h
20
AK/Variant.h
|
@ -271,11 +271,13 @@ public:
|
|||
requires(!(IsTriviallyCopyConstructible<Ts> && ...) || !(IsTriviallyDestructible<Ts> && ...))
|
||||
#endif
|
||||
{
|
||||
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {
|
||||
Helper::delete_(m_index, m_data);
|
||||
if (this != &other) {
|
||||
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {
|
||||
Helper::delete_(m_index, m_data);
|
||||
}
|
||||
m_index = other.m_index;
|
||||
Helper::copy_(other.m_index, other.m_data, m_data);
|
||||
}
|
||||
m_index = other.m_index;
|
||||
Helper::copy_(other.m_index, other.m_data, m_data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -284,11 +286,13 @@ public:
|
|||
requires(!(IsTriviallyMoveConstructible<Ts> && ...) || !(IsTriviallyDestructible<Ts> && ...))
|
||||
#endif
|
||||
{
|
||||
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {
|
||||
Helper::delete_(m_index, m_data);
|
||||
if (this != &other) {
|
||||
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {
|
||||
Helper::delete_(m_index, m_data);
|
||||
}
|
||||
m_index = other.m_index;
|
||||
Helper::move_(other.m_index, other.m_data, m_data);
|
||||
}
|
||||
m_index = other.m_index;
|
||||
Helper::move_(other.m_index, other.m_data, m_data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue