Skip to content

Commit

Permalink
refactor: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Aug 20, 2022
1 parent 9e6a726 commit 9098407
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 77 deletions.
4 changes: 2 additions & 2 deletions mixin/include/mixin/mixin.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ template <typename MostDerived> struct MixinTop { /* not a mixin */
// clang-format off
auto self() & -> decltype(auto) { return static_cast<self_type &>(*this); }
auto self() && -> decltype(auto) { return static_cast<self_type &&>(*this); }
auto self() const & -> decltype(auto) { return static_cast<self_type const &>(*this); }
auto self() const && -> decltype(auto) { return static_cast<self_type const &&>(*this); }
[[nodiscard]] auto self() const & -> decltype(auto) { return static_cast<self_type const &>(*this); }
[[nodiscard]] auto self() const && -> decltype(auto) { return static_cast<self_type const &&>(*this); }
// clang-format on
};

Expand Down
21 changes: 1 addition & 20 deletions mixin/test/mixin_chained_init_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,12 @@
// SPDX-License-Identifier: BSD-3-Clause
//===----------------------------------------------------------------------===//

#include <mixin/mixin.h>

#include <common/compilers.h>
#include "mixin/mixin.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <sstream>

// Disable compiler and linter warnings originating from the unit test framework
// and for which we cannot do anything. Additionally, every TEST or TEST_X macro
// usage must be preceded by a '// NOLINTNEXTLINE'.
ASAP_DIAGNOSTIC_PUSH
#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused")
#pragma clang diagnostic ignored "-Wused-but-marked-unused"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wunused-member-function"
#endif
// NOLINTBEGIN(used-but-marked-unused)

using testing::Eq;
using testing::IsTrue;

namespace asap::mixin {

Expand Down Expand Up @@ -69,6 +53,3 @@ TEST(MixinChainedInit, MixinConstructorForwardsUnusedArgumentsToBase) {
} // namespace

} // namespace asap::mixin

// NOLINTEND(used-but-marked-unused)
ASAP_DIAGNOSTIC_POP
18 changes: 1 addition & 17 deletions mixin/test/mixin_curry_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@
// SPDX-License-Identifier: BSD-3-Clause
//===----------------------------------------------------------------------===//

#include <mixin/mixin.h>

#include <common/compilers.h>
#include "mixin/mixin.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

// Disable compiler and linter warnings originating from the unit test framework
// and for which we cannot do anything. Additionally, every TEST or TEST_X macro
// usage must be preceded by a '// NOLINTNEXTLINE'.
ASAP_DIAGNOSTIC_PUSH
#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused")
#pragma clang diagnostic ignored "-Wused-but-marked-unused"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wunused-member-function"
#endif
// NOLINTBEGIN(used-but-marked-unused)

namespace asap::mixin {

namespace {
Expand Down Expand Up @@ -56,6 +43,3 @@ TEST(MixinCurry, MultipleTemplateParameters) {
} // namespace

} // namespace asap::mixin

// NOLINTEND(used-but-marked-unused)
ASAP_DIAGNOSTIC_POP
20 changes: 2 additions & 18 deletions mixin/test/mixin_interfaces_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@
// SPDX-License-Identifier: BSD-3-Clause
//===----------------------------------------------------------------------===//

#include <mixin/mixin.h>

#include <common/compilers.h>
#include "mixin/mixin.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

// Disable compiler and linter warnings originating from the unit test framework
// and for which we cannot do anything. Additionally, every TEST or TEST_X macro
// usage must be preceded by a '// NOLINTNEXTLINE'.
ASAP_DIAGNOSTIC_PUSH
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wused-but-marked-unused"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wunused-member-function"
#endif
// NOLINTBEGIN(used-but-marked-unused)

using testing::NotNull;

namespace asap::mixin {
Expand All @@ -37,7 +24,7 @@ struct Interface {
auto operator=(const Interface &) -> Interface & = default;
auto operator=(Interface &&) noexcept -> Interface & = default;

virtual void foo() = 0;
[[maybe_unused]] virtual void foo() = 0;
};
//! [Virtual interface]

Expand Down Expand Up @@ -82,6 +69,3 @@ TEST(MixinInterfaces, MixinCanProvideInterface) {
} // namespace

} // namespace asap::mixin

// NOLINTEND(used-but-marked-unused)
ASAP_DIAGNOSTIC_POP
23 changes: 3 additions & 20 deletions mixin/test/mixin_top_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,14 @@
// SPDX-License-Identifier: BSD-3-Clause
//===----------------------------------------------------------------------===//

#include <mixin/mixin.h>
#include "mixin/mixin.h"

#include <common/compilers.h>
#include <sstream>

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <sstream>

// Disable compiler and linter warnings originating from the unit test framework
// and for which we cannot do anything. Additionally, every TEST or TEST_X macro
// usage must be preceded by a '// NOLINTNEXTLINE'.
ASAP_DIAGNOSTIC_PUSH
#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused")
#pragma clang diagnostic ignored "-Wused-but-marked-unused"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wunused-member-function"
#endif
// NOLINTBEGIN(used-but-marked-unused)

using testing::Eq;
using testing::IsTrue;

namespace asap::mixin {

Expand Down Expand Up @@ -69,13 +55,10 @@ TEST(MixinSelf, CompositionOrderDoesNotMatter) {
struct Concrete2 : Mixin<Concrete2, WithLogging, Persistence> {};
//! [Composition order does not matter]

[[maybe_unused]] Concrete1 concreate_1;
[[maybe_unused]] Concrete1 concrete_1;
[[maybe_unused]] Concrete2 concrete_2;
}

} // namespace

} // namespace asap::mixin

// NOLINTEND(used-but-marked-unused)
ASAP_DIAGNOSTIC_POP

0 comments on commit 9098407

Please sign in to comment.