diff --git a/.clang-format b/.clang-format index 4a24aec430..a7443c22bf 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: BlockIndent -AlignArrayOfStructures: Left +AlignArrayOfStructures: Right AlignConsecutiveDeclarations: Enabled: true AcrossEmptyLines: false @@ -44,3 +44,8 @@ PointerAlignment: Left TabWidth: 4 UseTab: Never SortIncludes: CaseSensitive +# RemoveEmptyLinesInUnwrappedLines: true +RemoveSemicolon: true +# SeparateDefinitionBlocks: Always +SortUsingDeclarations: LexicographicNumeric +Standard: Latest \ No newline at end of file diff --git a/scripts/encode_dectect.py b/scripts/encode_dectect.py new file mode 100644 index 0000000000..a6ca18af27 --- /dev/null +++ b/scripts/encode_dectect.py @@ -0,0 +1,14 @@ +# execute clang-format at src with multi-threading + +import os +import chardet + +if __name__ == "__main__": + for path in ["./src", "./src-server", "./src-client", "./src-test"]: + for root, dirs, files in os.walk(path): + for file in files: + if file.endswith(".h") or file.endswith(".cpp"): + with open(os.path.join(root, file), "rb") as f: + d = chardet.detect(f.read()) + if d.get('encoding') != 'ascii' and d.get('encoding') != 'utf-8': + print(d, file) diff --git a/src-client/ll/core/gui/ImguiConfig.cpp b/src-client/ll/core/gui/ImguiConfig.cpp index 34fa760775..a4a596614c 100644 --- a/src-client/ll/core/gui/ImguiConfig.cpp +++ b/src-client/ll/core/gui/ImguiConfig.cpp @@ -25,8 +25,8 @@ LL_CONFIG_IMPL(LeviImguiConfig, u8"ImguiConfig.json"); std::vector LeviImguiConfig::getDefaultFonts() { if (i18n::getDefaultLocaleCode().starts_with("zh")) { return { - {"default", Font::GlyphRange::Latins, Font::Width::Half}, - {"system", Font::GlyphRange::ChineseFull, Font::Width::Full} + {"default", Font::GlyphRange::Latins, Font::Width::Half}, + { "system", Font::GlyphRange::ChineseFull, Font::Width::Full} }; } return { diff --git a/src-client/ll/core/gui/win/GUI.cpp b/src-client/ll/core/gui/win/GUI.cpp index af21e3ff3c..33f0ee47dc 100644 --- a/src-client/ll/core/gui/win/GUI.cpp +++ b/src-client/ll/core/gui/win/GUI.cpp @@ -1,4 +1,4 @@ -#include "ll/core/gui/GUI.h" +#include "ll/core/gui/GUI.h" #include #include @@ -13,10 +13,10 @@ #include "imgui.h" -#include "ll/core/gui/ImGuiAnsiColor.h" -#include "ll/core/gui/ImGuiHooks.h" #include "ll/api/utils/FontUtils.h" #include "ll/api/utils/StringUtils.h" +#include "ll/core/gui/ImGuiAnsiColor.h" +#include "ll/core/gui/ImGuiHooks.h" #include "ll/core/gui/ImguiConfig.h" #include "ll/core/gui/styles/ImguiSpectrum.h" #include "ll/core/io/LogPipe.h" @@ -131,7 +131,7 @@ void initializeImGui() { io.IniFilename = nullptr; io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; - + // io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; diff --git a/src-server/ll/api/form/CustomForm.cpp b/src-server/ll/api/form/CustomForm.cpp index 453d0fc325..c09b63f999 100644 --- a/src-server/ll/api/form/CustomForm.cpp +++ b/src-server/ll/api/form/CustomForm.cpp @@ -23,7 +23,7 @@ class Label : public CustomFormElement { [[nodiscard]] nlohmann::ordered_json serialize() const override { return { {"type", "label"}, - {"text", mText } + {"text", mText} }; } @@ -49,7 +49,7 @@ class Input : public CustomFormElement { [[nodiscard]] nlohmann::ordered_json serialize() const override { nlohmann::ordered_json input = { {"type", "input"}, - {"text", mText } + {"text", mText} }; if (!mPlaceholder.empty()) { input["placeholder"] = mPlaceholder; @@ -81,8 +81,8 @@ class Toggle : public CustomFormElement { [[nodiscard]] nlohmann::ordered_json serialize() const override { return { - {"type", "toggle"}, - {"text", mText }, + { "type", "toggle"}, + { "text", mText}, {"default", mDefault} }; } @@ -110,10 +110,10 @@ class Dropdown : public CustomFormElement { [[nodiscard]] nlohmann::ordered_json serialize() const override { return { - {"type", "dropdown"}, - {"text", mText }, - {"options", mOptions }, - {"default", mDefault } + { "type", "dropdown"}, + { "text", mText}, + {"options", mOptions}, + {"default", mDefault} }; } @@ -173,11 +173,11 @@ class Slider : public CustomFormElement { return {}; } return { - {"type", "slider"}, - {"text", mText }, - {"min", mMin }, - {"max", mMax }, - {"step", mStep }, + { "type", "slider"}, + { "text", mText}, + { "min", mMin}, + { "max", mMax}, + { "step", mStep}, {"default", mDefault} }; } @@ -219,10 +219,10 @@ class StepSlider : public CustomFormElement { return {}; } return { - {"type", "step_slider"}, - {"text", mText }, - {"steps", mSteps }, - {"default", mDefault } + { "type", "step_slider"}, + { "text", mText}, + { "steps", mSteps}, + {"default", mDefault} }; } @@ -265,8 +265,8 @@ class CustomForm::CustomFormImpl : public FormImpl { [[nodiscard]] nlohmann::ordered_json serialize() const override { nlohmann::ordered_json form = { - {"title", mTitle }, - {"type", "custom_form" }, + { "title", mTitle}, + { "type", "custom_form"}, {"content", nlohmann::ordered_json::array()} }; for (auto& e : mElements) { diff --git a/src-server/ll/api/form/ModalForm.cpp b/src-server/ll/api/form/ModalForm.cpp index f90be95d36..e12b70f849 100644 --- a/src-server/ll/api/form/ModalForm.cpp +++ b/src-server/ll/api/form/ModalForm.cpp @@ -46,9 +46,9 @@ class ModalForm::ModalFormImpl : public FormImpl { [[nodiscard]] nlohmann::ordered_json serialize() const override { return { - {"type", "modal" }, - {"title", mTitle }, - {"content", mContent }, + { "type", "modal"}, + { "title", mTitle}, + {"content", mContent}, {"button1", mUpperButton}, {"button2", mLowerButton} }; diff --git a/src-server/ll/api/form/SimpleForm.cpp b/src-server/ll/api/form/SimpleForm.cpp index 4007ce75f5..72f0a97276 100644 --- a/src-server/ll/api/form/SimpleForm.cpp +++ b/src-server/ll/api/form/SimpleForm.cpp @@ -103,9 +103,9 @@ class SimpleForm::SimpleFormImpl : public FormImpl { [[nodiscard]] nlohmann::ordered_json serialize() const override { nlohmann::ordered_json form = { - {"title", mTitle }, - {"type", "form" }, - {"content", mContent }, + { "title", mTitle}, + { "type", "form"}, + {"content", mContent}, {"buttons", nlohmann::ordered_json::array()} }; for (auto& e : mElements) { diff --git a/src-server/ll/core/Statistics.cpp b/src-server/ll/core/Statistics.cpp index cce8859c86..4557365766 100644 --- a/src-server/ll/core/Statistics.cpp +++ b/src-server/ll/core/Statistics.cpp @@ -175,7 +175,7 @@ void Statistics::call(bool enable) { } else if (!enable) { impl.reset(); } -}; +} Statistics::Statistics() = default; Statistics::~Statistics() = default; diff --git a/src-server/ll/core/tweak/ForceEnableCheatCommands.cpp b/src-server/ll/core/tweak/ForceEnableCheatCommands.cpp index 90d0df8c4b..617e5e3407 100644 --- a/src-server/ll/core/tweak/ForceEnableCheatCommands.cpp +++ b/src-server/ll/core/tweak/ForceEnableCheatCommands.cpp @@ -76,7 +76,7 @@ void ForceEnableCheatCommands::call(bool enable) { } else { impl.reset(); } -}; +} ForceEnableCheatCommands::ForceEnableCheatCommands() = default; ForceEnableCheatCommands::~ForceEnableCheatCommands() = default; diff --git a/src-test/server/ConfigTest.cpp b/src-test/server/ConfigTest.cpp index d6764caf59..dd68a09f1d 100644 --- a/src-test/server/ConfigTest.cpp +++ b/src-test/server/ConfigTest.cpp @@ -67,15 +67,15 @@ class TestClass { int plain = 1111; std::map amap = { - {"key1", {} }, + {"key1", {}}, {"key2", {"a new thing", 42}}, - {"key3", {} }, + {"key3", {}}, }; std::map bmap = { - {{}, 4454556 }, - {{2, 3}, 4366 }, - {{4, 5}, -63556654}, - {mce::UUID::random(), -5674236 }, + { {}, 4454556}, + { {2, 3}, 4366}, + { {4, 5}, -63556654}, + {mce::UUID::random(), -5674236}, }; Vec2 vec2{}; diff --git a/src-test/server/Packet_test.cpp b/src-test/server/Packet_test.cpp index 4bc826b15e..ead15bd8fa 100644 --- a/src-test/server/Packet_test.cpp +++ b/src-test/server/Packet_test.cpp @@ -1,4 +1,4 @@ -// #define GENERATE_PACKET +// #define GENERATE_PACKET #ifdef GENERATE_PACKET diff --git a/src-test/server/TestNbt.cpp b/src-test/server/TestNbt.cpp index de581d9db7..1692414979 100644 --- a/src-test/server/TestNbt.cpp +++ b/src-test/server/TestNbt.cpp @@ -16,21 +16,21 @@ LL_AUTO_TYPE_INSTANCE_HOOK(NbtTest, HookPriority::Normal, ServerInstance, &Serve using namespace ll::literals; auto nbt = CompoundTag{ - {"anull", nullptr }, - {"string?", R"(streee _ _o-ix 我超, utf8 "\asfa%"*)##q)$\\"\Q34\\""'':)"_tag}, - {"1num", 1 }, - {"nums", (int16)3 }, - {"byte", (int8)127 }, - {"list", ListTag{5_b, ByteTag{true}, ByteTag{false}, -2_b} }, - {"compound", + { "anull", nullptr }, + { "string?", R"(streee _ _o-ix 我超, utf8 "\asfa%"*)##q)$\\"\Q34\\""'':)"_tag}, + { "1num", 1}, + { "nums", (int16)3}, + { "byte", (int8)127}, + { "list", ListTag{5_b, ByteTag{true}, ByteTag{false}, -2_b}}, + { "compound", CompoundTag{ - {"float", 0.1f}, - {"long", 10000ull}, - {"double", 0.3}, - {"sdouble", 1.0}, + {"float", 0.1f}, + {"long", 10000ull}, + {"double", 0.3}, + {"sdouble", 1.0}, } }, - {"bytearray", ByteArrayTag{1, 2, 3, 4, 5, 62, 63, 66} }, - {"intarray", IntArrayTag{1, 2, 3, 4, 5, -2, -3, -6} }, + {"bytearray", ByteArrayTag{1, 2, 3, 4, 5, 62, 63, 66}}, + { "intarray", IntArrayTag{1, 2, 3, 4, 5, -2, -3, -6}}, }; nbt["some"]["new"]["compound"] = nbt; @@ -38,8 +38,8 @@ LL_AUTO_TYPE_INSTANCE_HOOK(NbtTest, HookPriority::Normal, ServerInstance, &Serve nlohmann::json j{ - {"num", 1 }, - {"nums", (int16)3 }, + { "num", 1}, + {"nums", (int16)3}, {"byte", (int8)127} }; j["some"]["new"]["json"] = 2; diff --git a/src-test/server/testCommand.cpp b/src-test/server/testCommand.cpp index 18c7ce70a8..d721d73f08 100644 --- a/src-test/server/testCommand.cpp +++ b/src-test/server/testCommand.cpp @@ -125,7 +125,7 @@ LL_AUTO_TYPE_INSTANCE_HOOK( "testenum", { {"testenumhhhh", 124144}, - {"hrshh54w4t4", 67584 } + { "hrshh54w4t4", 67584} } ); diff --git a/src/ll/api/base/ToString.h b/src/ll/api/base/ToString.h index c9200a2f78..1a529f52cf 100644 --- a/src/ll/api/base/ToString.h +++ b/src/ll/api/base/ToString.h @@ -40,7 +40,7 @@ struct fmt::formatter : fmt::formatter { // std::format support template -struct std::formatter : std::formatter { // NOLINT +struct std::formatter : std::formatter { template auto format(T const& t, FormatContext& ctx) const { return std::formatter::format(nonstd::to_string(t), ctx); diff --git a/src/ll/api/coro/CoroTask.h b/src/ll/api/coro/CoroTask.h index 2aeea2bd05..89ad28d47e 100644 --- a/src/ll/api/coro/CoroTask.h +++ b/src/ll/api/coro/CoroTask.h @@ -30,7 +30,7 @@ class CoroTask { public: struct ExpectedAwaiter : public WaiterBase { constexpr ExpectedAwaiter(Handle h) : WaiterBase(h) {} - constexpr ExpectedResult await_resume() noexcept { return WaiterBase::getResult(); }; + constexpr ExpectedResult await_resume() noexcept { return WaiterBase::getResult(); } }; struct ValueAwaiter : public WaiterBase { @@ -53,7 +53,7 @@ class CoroTask { if (handle) { std::exchange(handle, nullptr).destroy(); } - }; + } constexpr void setExecutor(ExecutorRef ex) { handle.promise().exec = ex; } diff --git a/src/ll/api/data/KeyValueDB.cpp b/src/ll/api/data/KeyValueDB.cpp index 40c2819605..57984ec0f3 100644 --- a/src/ll/api/data/KeyValueDB.cpp +++ b/src/ll/api/data/KeyValueDB.cpp @@ -1,4 +1,4 @@ -#include "ll/api/data/KeyValueDB.h" +#include "ll/api/data/KeyValueDB.h" #include #include @@ -59,6 +59,7 @@ KeyValueDB::KeyValueDB(std::filesystem::path const& path, bool createIfMiss, boo bloomFilterBit ); } + KeyValueDB::KeyValueDB(std::filesystem::path const& path) : KeyValueDB(path, true, true, 0) {} KeyValueDB::KeyValueDB(KeyValueDB&&) noexcept = default; @@ -75,11 +76,13 @@ std::optional KeyValueDB::get(std::string_view key) const { } return result; } + bool KeyValueDB::set(std::string_view key, std::string_view val) { return impl->db ->Put(impl->writeOptions, leveldb::Slice(key.data(), key.size()), leveldb::Slice(val.data(), val.size())) .ok(); } + bool KeyValueDB::has(std::string_view key) const { std::unique_ptr it(impl->db->NewIterator(impl->readOptions)); auto slice = leveldb::Slice(key.data(), key.size()); @@ -89,14 +92,17 @@ bool KeyValueDB::has(std::string_view key) const { } return false; } + bool KeyValueDB::empty() const { std::unique_ptr it(impl->db->NewIterator(impl->readOptions)); it->SeekToFirst(); return it->Valid(); } + bool KeyValueDB::del(std::string_view key) { return impl->db->Delete(impl->writeOptions, leveldb::Slice(key.data(), key.size())).ok(); } + void KeyValueDB::iter(std::function const& fn) const { std::unique_ptr it(impl->db->NewIterator(impl->readOptions)); for (it->SeekToFirst(); it->Valid(); it->Next()) { @@ -107,6 +113,7 @@ void KeyValueDB::iter(std::function co } } } + coro::Generator> KeyValueDB::iter() const { std::unique_ptr it(impl->db->NewIterator(impl->readOptions)); for (it->SeekToFirst(); it->Valid(); it->Next()) { diff --git a/src/ll/api/data/KeyValueDB.h b/src/ll/api/data/KeyValueDB.h index a3e6dbc94d..3a5e897ada 100644 --- a/src/ll/api/data/KeyValueDB.h +++ b/src/ll/api/data/KeyValueDB.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include diff --git a/src/ll/api/memory/MemoryOperators.h b/src/ll/api/memory/MemoryOperators.h index 6723d54009..d863e65f31 100644 --- a/src/ll/api/memory/MemoryOperators.h +++ b/src/ll/api/memory/MemoryOperators.h @@ -19,9 +19,9 @@ void operator delete[](void* p) noexcept { operator delete(p); } void operator delete[](void* p, std::nothrow_t const&) noexcept { operator delete[](p); } -void operator delete(void* p, std::size_t) noexcept { operator delete(p); }; +void operator delete(void* p, std::size_t) noexcept { operator delete(p); } -void operator delete[](void* p, std::size_t) noexcept { operator delete[](p); }; +void operator delete[](void* p, std::size_t) noexcept { operator delete[](p); } void operator delete(void* p, std::align_val_t) noexcept { ::ll::memory::getDefaultAllocator().alignedRelease(p); } @@ -33,9 +33,9 @@ void operator delete[](void* p, std::align_val_t alignment) noexcept { operator void operator delete[](void* p, std::align_val_t alignment, std::nothrow_t const&) noexcept { operator delete[](p, alignment); } -void operator delete(void* p, std::size_t, std::align_val_t alignment) noexcept { operator delete(p, alignment); }; +void operator delete(void* p, std::size_t, std::align_val_t alignment) noexcept { operator delete(p, alignment); } -void operator delete[](void* p, std::size_t, std::align_val_t alignment) noexcept { operator delete[](p, alignment); }; +void operator delete[](void* p, std::size_t, std::align_val_t alignment) noexcept { operator delete[](p, alignment); } [[nodiscard]] LL_ALLOCATOR void* operator new(std::size_t size) { if (void* const block = ::ll::memory::getDefaultAllocator().allocate(size)) { diff --git a/src/ll/api/memory/x64/Closure.cpp b/src/ll/api/memory/x64/Closure.cpp index ef750077a1..da2067084a 100644 --- a/src/ll/api/memory/x64/Closure.cpp +++ b/src/ll/api/memory/x64/Closure.cpp @@ -33,7 +33,7 @@ size_t getVolatileOffset(void* impl) { } getLogger().fatal("ClosureMagicNumber does not found 0x{}", impl); return 0; -}; +} using T = NativeClosure; void initNativeClosure(void* self, void* impl, size_t offset) { auto size = offset + sizeof(NativeClosurePrologue); diff --git a/src/ll/api/reflection/Dispatcher.h b/src/ll/api/reflection/Dispatcher.h index 809a5cbd47..4c4e4ed5a8 100644 --- a/src/ll/api/reflection/Dispatcher.h +++ b/src/ll/api/reflection/Dispatcher.h @@ -32,8 +32,8 @@ class Dispatcher { return *this; } - operator Storage const&() const { return storage; } // NOLINT + operator Storage const&() const { return storage; } - operator Storage&() { return storage; } // NOLINT + operator Storage&() { return storage; } }; } // namespace ll::reflection diff --git a/src/ll/api/utils/ErrorUtils_win.cpp b/src/ll/api/utils/ErrorUtils_win.cpp index c64fb10528..8ec1704c3b 100644 --- a/src/ll/api/utils/ErrorUtils_win.cpp +++ b/src/ll/api/utils/ErrorUtils_win.cpp @@ -162,8 +162,8 @@ void initExceptionTranslator() { _set_se_translator(error_utils::translateSEHtoC std::system_error getLastSystemError() noexcept { return std::error_code{(int)GetLastError(), u8system_category()}; } -extern "C" PEXCEPTION_RECORD* __current_exception(); // NOLINT -extern "C" PCONTEXT* __current_exception_context(); // NOLINT +extern "C" PEXCEPTION_RECORD* __current_exception(); +extern "C" PCONTEXT* __current_exception_context(); optional_ref<::_EXCEPTION_RECORD> current_exception_record() noexcept { return **__current_exception(); } optional_ref<_CONTEXT> current_exception_context() noexcept { return **__current_exception_context(); } diff --git a/src/ll/api/utils/HashUtils.h b/src/ll/api/utils/HashUtils.h index 012101c923..459f4a545b 100644 --- a/src/ll/api/utils/HashUtils.h +++ b/src/ll/api/utils/HashUtils.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include diff --git a/src/ll/api/utils/StringUtils_win.cpp b/src/ll/api/utils/StringUtils_win.cpp index 894e121f09..24896997a7 100644 --- a/src/ll/api/utils/StringUtils_win.cpp +++ b/src/ll/api/utils/StringUtils_win.cpp @@ -287,6 +287,7 @@ std::string tou8str(std::string_view str) { return str2str(str, CodePage::DefaultACP, CodePage::UTF8); } } + std::string toSnakeCase(std::string_view str) { std::string res; if (str.empty()) { @@ -304,11 +305,13 @@ std::string toSnakeCase(std::string_view str) { } return res; } + std::string toLowerCase(std::string_view str) { std::string res{str}; std::transform(res.begin(), res.end(), res.begin(), [](char c) { return (char)std::tolower(c); }); return res; } + Expected svtobool(std::string_view str) { if (str.size() <= 4) { auto lower = toLowerCase(str); diff --git a/src/ll/core/mod/NativeModManager.cpp b/src/ll/core/mod/NativeModManager.cpp index 0277e2ea0d..72ff8876a0 100644 --- a/src/ll/core/mod/NativeModManager.cpp +++ b/src/ll/core/mod/NativeModManager.cpp @@ -80,7 +80,7 @@ Expected<> NativeModManager::load(Manifest manifest) { auto l(lock()); currentLoadingMod = std::make_shared(std::move(manifest)); struct Remover { - ~Remover() { currentLoadingMod = nullptr; }; + ~Remover() { currentLoadingMod = nullptr; } } r; std::error_code ec; auto modDir = getModsRoot() / string_utils::sv2u8sv(currentLoadingMod->getName()); diff --git a/src/ll/core/tweak/ModifyInfomation.cpp b/src/ll/core/tweak/ModifyInfomation.cpp index 73d339dd7d..54aebd9923 100644 --- a/src/ll/core/tweak/ModifyInfomation.cpp +++ b/src/ll/core/tweak/ModifyInfomation.cpp @@ -12,7 +12,7 @@ #include "mc/diagnostics/Interface.h" #include "mc/world/level/storage/DBStorage.h" -MCAPI void BedrockLogOut(uint priority, char const* pszFormat, ...); // NOLINT +MCAPI void BedrockLogOut(uint priority, char const* pszFormat, ...); namespace ll { @@ -125,10 +125,10 @@ LL_TYPE_INSTANCE_HOOK( &::BedrockLog::LogDetails::_appendLogEntryMetadata, void, std::string&, - std::string, // NOLINT + std::string, ::LogAreaID, uint, - std::string, // NOLINT + std::string, int, int ) {} diff --git a/src/mc/common/ActorRuntimeID.h b/src/mc/common/ActorRuntimeID.h index b3d22265a9..0797bb8b93 100644 --- a/src/mc/common/ActorRuntimeID.h +++ b/src/mc/common/ActorRuntimeID.h @@ -7,9 +7,9 @@ class ActorRuntimeID { uint64 id; [[nodiscard]] constexpr ActorRuntimeID() : id(0) {} - [[nodiscard]] constexpr ActorRuntimeID(uint64 x) : id(x) {} // NOLINT + [[nodiscard]] constexpr ActorRuntimeID(uint64 x) : id(x) {} - [[nodiscard]] constexpr operator uint64() const { return id; } // NOLINT + [[nodiscard]] constexpr operator uint64() const { return id; } }; namespace std { diff --git a/src/mc/common/SharedPtr.h b/src/mc/common/SharedPtr.h index a47965da81..16d08b8853 100644 --- a/src/mc/common/SharedPtr.h +++ b/src/mc/common/SharedPtr.h @@ -14,8 +14,8 @@ class SharedPtr { return SharedPtr(new T(std::forward(args)...)); } - [[nodiscard]] SharedPtr() noexcept : counter(nullptr) {} // NOLINT - [[nodiscard]] SharedPtr(std::nullptr_t) noexcept : counter(nullptr) {} // NOLINT + [[nodiscard]] SharedPtr() noexcept : counter(nullptr) {} + [[nodiscard]] SharedPtr(std::nullptr_t) noexcept : counter(nullptr) {} [[nodiscard]] explicit SharedPtr(T* p) : counter(new SharedCounter(p)) {} diff --git a/src/mc/common/WeakPtr.h b/src/mc/common/WeakPtr.h index 517850196b..142a2f0886 100644 --- a/src/mc/common/WeakPtr.h +++ b/src/mc/common/WeakPtr.h @@ -9,8 +9,8 @@ class SharedPtr; template class WeakPtr { public: - [[nodiscard]] WeakPtr() noexcept : counter(nullptr) {} // NOLINT - [[nodiscard]] WeakPtr(std::nullptr_t) noexcept : counter(nullptr) {} // NOLINT + [[nodiscard]] WeakPtr() noexcept : counter(nullptr) {} + [[nodiscard]] WeakPtr(std::nullptr_t) noexcept : counter(nullptr) {} template [[nodiscard]] explicit WeakPtr(SharedPtr const& other) diff --git a/src/mc/deps/core/container/Blob.h b/src/mc/deps/core/container/Blob.h index 0d32062585..7d8087ff54 100644 --- a/src/mc/deps/core/container/Blob.h +++ b/src/mc/deps/core/container/Blob.h @@ -33,7 +33,7 @@ class Blob { [[nodiscard]] LL_CONSTEXPR23 Blob() = default; - [[nodiscard]] LL_CONSTEXPR23 Blob(std::span s, Deleter deleter = {}) : mSize(s.size()) { // NOLINT + [[nodiscard]] LL_CONSTEXPR23 Blob(std::span s, Deleter deleter = {}) : mSize(s.size()) { mBlob = pointer_type(new value_type[mSize], deleter); std::copy(s.begin(), s.end(), mBlob.get()); } diff --git a/src/mc/deps/core/math/Color.h b/src/mc/deps/core/math/Color.h index fa3343aa9c..5824e6bc32 100644 --- a/src/mc/deps/core/math/Color.h +++ b/src/mc/deps/core/math/Color.h @@ -27,13 +27,13 @@ class Color : public ll::math::floatN4 { : floatN4(r, g, b, a) {} template - [[nodiscard]] constexpr Color(V const& v, A const& a = 1) noexcept // NOLINT + [[nodiscard]] constexpr Color(V const& v, A const& a = 1) noexcept requires(V::size() == 3) : floatN4(v.r, v.g, v.b, a) {} [[nodiscard]] constexpr Color(uint hex) noexcept : Color((hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF) {} - [[nodiscard]] constexpr Color(std::string_view hex) noexcept : floatN4(0, 0, 0, 1) { // NOLINT + [[nodiscard]] constexpr Color(std::string_view hex) noexcept : floatN4(0, 0, 0, 1) { if (hex[0] == '#') { hex = hex.substr(1); } @@ -58,7 +58,7 @@ class Color : public ll::math::floatN4 { default: return; } - }; + } [[nodiscard]] constexpr class Vec3 toVec3() const noexcept { return {r, g, b}; } diff --git a/src/mc/deps/core/string/HashedString.h b/src/mc/deps/core/string/HashedString.h index 23d4b57429..1d9835e685 100644 --- a/src/mc/deps/core/string/HashedString.h +++ b/src/mc/deps/core/string/HashedString.h @@ -18,20 +18,20 @@ class HashedString { } // Constructors - [[nodiscard]] constexpr HashedString(std::nullptr_t = nullptr) noexcept : hash(0), lastMatch(nullptr) {} // NOLINT + [[nodiscard]] constexpr HashedString(std::nullptr_t = nullptr) noexcept : hash(0), lastMatch(nullptr) {} [[nodiscard]] constexpr HashedString(uint64 h, char const* str) noexcept : hash(h), str(str), lastMatch(nullptr) {} [[nodiscard]] constexpr HashedString(std::string_view str) noexcept : hash(computeHash(str)), str(str), - lastMatch(nullptr) {} // NOLINT + lastMatch(nullptr) {} - [[nodiscard]] constexpr HashedString(std::string&& s) noexcept // NOLINT + [[nodiscard]] constexpr HashedString(std::string&& s) noexcept : hash(computeHash(s)), str(std::move(s)), lastMatch(nullptr) {} - [[nodiscard]] constexpr HashedString(char const* str) noexcept : HashedString(std::string{str}) {} // NOLINT + [[nodiscard]] constexpr HashedString(char const* str) noexcept : HashedString(std::string{str}) {} [[nodiscard]] constexpr HashedString(HashedString const& other) noexcept : hash(other.hash), @@ -120,9 +120,9 @@ class HashedString { } // Convertors - [[nodiscard]] constexpr operator std::string const&() const { return str; } // NOLINT + [[nodiscard]] constexpr operator std::string const&() const { return str; } - [[nodiscard]] constexpr operator std::string_view() const { return std::string_view(str); } // NOLINT + [[nodiscard]] constexpr operator std::string_view() const { return std::string_view(str); } public: // NOLINTBEGIN diff --git a/src/mc/deps/core/threading/MovePriorityQueue.h b/src/mc/deps/core/threading/MovePriorityQueue.h index 86bb4281b5..b4bea7c98a 100644 --- a/src/mc/deps/core/threading/MovePriorityQueue.h +++ b/src/mc/deps/core/threading/MovePriorityQueue.h @@ -20,24 +20,24 @@ class MovePriorityQueue { return result; } - [[nodiscard]] T& top() { return mC.front(); }; - [[nodiscard]] T const& top() const { return mC.front(); }; + [[nodiscard]] T& top() { return mC.front(); } + [[nodiscard]] T const& top() const { return mC.front(); } - [[nodiscard]] bool empty() { return mC.empty(); }; + [[nodiscard]] bool empty() { return mC.empty(); } - [[nodiscard]] size_t size() { return mC.size(); }; + [[nodiscard]] size_t size() { return mC.size(); } - [[nodiscard]] const_iterator begin() const { return mC.begin(); }; + [[nodiscard]] const_iterator begin() const { return mC.begin(); } - [[nodiscard]] const_iterator end() const { return mC.end(); }; + [[nodiscard]] const_iterator end() const { return mC.end(); } - [[nodiscard]] iterator begin() { return mC.begin(); }; + [[nodiscard]] iterator begin() { return mC.begin(); } - [[nodiscard]] iterator end() { return mC.end(); }; + [[nodiscard]] iterator end() { return mC.end(); } [[nodiscard]] Base& getInternalContainer() { return mC; } void clear() { mC.clear(); } - void resort() { std::make_heap(mC.begin(), mC.end(), Comparator{}); }; + void resort() { std::make_heap(mC.begin(), mC.end(), Comparator{}); } }; diff --git a/src/mc/deps/core/utility/AutomaticID.h b/src/mc/deps/core/utility/AutomaticID.h index 1e2f63409b..d22260a57e 100644 --- a/src/mc/deps/core/utility/AutomaticID.h +++ b/src/mc/deps/core/utility/AutomaticID.h @@ -11,9 +11,9 @@ class AutomaticID { [[nodiscard]] constexpr AutomaticID() : id(0) {} - [[nodiscard]] constexpr AutomaticID(T x) : id(x) {} // NOLINT + [[nodiscard]] constexpr AutomaticID(T x) : id(x) {} - [[nodiscard]] constexpr operator T() const { return id; } // NOLINT + [[nodiscard]] constexpr operator T() const { return id; } }; namespace std { diff --git a/src/mc/deps/core/utility/MCRESULT.h b/src/mc/deps/core/utility/MCRESULT.h index 6d98b20cac..9aa7914404 100644 --- a/src/mc/deps/core/utility/MCRESULT.h +++ b/src/mc/deps/core/utility/MCRESULT.h @@ -9,7 +9,7 @@ struct MCRESULT { ::MCCATEGORY mCategory; ushort mCode; - operator bool() const noexcept { return mSuccess; } // NOLINT + operator bool() const noexcept { return mSuccess; } public: // NOLINTBEGIN diff --git a/src/mc/deps/ecs/EntityId.h b/src/mc/deps/ecs/EntityId.h index 572e669fce..2ff586e807 100644 --- a/src/mc/deps/ecs/EntityId.h +++ b/src/mc/deps/ecs/EntityId.h @@ -15,7 +15,7 @@ class EntityId : public entt::entt_traits { template requires(!std::is_same_v, bool>) - [[nodiscard]] constexpr EntityId(T rawId) : mRawId(static_cast(rawId)) {} // NOLINT + [[nodiscard]] constexpr EntityId(T rawId) : mRawId(static_cast(rawId)) {} [[nodiscard]] constexpr bool isNull() const { return *this == entt::null; } diff --git a/src/mc/deps/game_refs/OwnerPtr.h b/src/mc/deps/game_refs/OwnerPtr.h index ad974f0963..93427b2cfa 100644 --- a/src/mc/deps/game_refs/OwnerPtr.h +++ b/src/mc/deps/game_refs/OwnerPtr.h @@ -68,7 +68,7 @@ class OwnerPtr { constexpr void reset() { mHandle.reset(); } - constexpr operator bool() const { return mHandle != nullptr; } // NOLINT + constexpr operator bool() const { return mHandle != nullptr; } constexpr T* get() const { return mHandle.get(); } diff --git a/src/mc/deps/game_refs/StackRefResult.h b/src/mc/deps/game_refs/StackRefResult.h index 88c4ea938b..93eaafb24a 100644 --- a/src/mc/deps/game_refs/StackRefResult.h +++ b/src/mc/deps/game_refs/StackRefResult.h @@ -68,7 +68,7 @@ class StackRefResult { constexpr void reset() { mHandle.reset(); } - constexpr operator bool() const { return mHandle != nullptr; } // NOLINT + constexpr operator bool() const { return mHandle != nullptr; } constexpr T* get() const { return mHandle.get(); } diff --git a/src/mc/deps/game_refs/WeakRef.h b/src/mc/deps/game_refs/WeakRef.h index 35cb347922..3efc52a10a 100644 --- a/src/mc/deps/game_refs/WeakRef.h +++ b/src/mc/deps/game_refs/WeakRef.h @@ -93,7 +93,7 @@ class WeakRef { return sp.get(); } - constexpr operator bool() const { return get() != nullptr; } // NOLINT + constexpr operator bool() const { return get() != nullptr; } constexpr T& operator*() const { return *get(); } diff --git a/src/mc/deps/raknet/SystemAddress.h b/src/mc/deps/raknet/SystemAddress.h index 2eebfb2334..75e7dc97f4 100644 --- a/src/mc/deps/raknet/SystemAddress.h +++ b/src/mc/deps/raknet/SystemAddress.h @@ -12,7 +12,7 @@ struct SystemAddress { ushort debugPort; // this+0x80 ushort systemIndex; // this+0x82 - [[nodiscard]] operator std::string() const { return ToString(); } // NOLINT + [[nodiscard]] operator std::string() const { return ToString(); } public: // NOLINTBEGIN diff --git a/src/mc/nbt/ByteArrayTag.h b/src/mc/nbt/ByteArrayTag.h index 4c7843d3af..740d3d205d 100644 --- a/src/mc/nbt/ByteArrayTag.h +++ b/src/mc/nbt/ByteArrayTag.h @@ -14,9 +14,9 @@ class ByteArrayTag : public ::Tag, public std::vector { [[nodiscard]] constexpr ByteArrayTag() = default; - [[nodiscard]] constexpr ByteArrayTag(Array arr) : Array(std::move(arr)) {} // NOLINT + [[nodiscard]] constexpr ByteArrayTag(Array arr) : Array(std::move(arr)) {} - [[nodiscard]] constexpr ByteArrayTag(std::initializer_list val) : Array(val) {} // NOLINT + [[nodiscard]] constexpr ByteArrayTag(std::initializer_list val) : Array(val) {} public: diff --git a/src/mc/nbt/ByteTag.h b/src/mc/nbt/ByteTag.h index ad4ab66e0a..34818ea9a8 100644 --- a/src/mc/nbt/ByteTag.h +++ b/src/mc/nbt/ByteTag.h @@ -21,7 +21,7 @@ class ByteTag : public ::Tag { return (T)data; } - [[nodiscard]] constexpr operator std::byte() const { return (std::byte)data; } // NOLINT + [[nodiscard]] constexpr operator std::byte() const { return (std::byte)data; } template [[nodiscard]] constexpr explicit ByteTag(T value = 0) : data((schar)value) {} diff --git a/src/mc/nbt/CompoundTag.h b/src/mc/nbt/CompoundTag.h index adc6d6fb64..0e243d4f41 100644 --- a/src/mc/nbt/CompoundTag.h +++ b/src/mc/nbt/CompoundTag.h @@ -18,9 +18,9 @@ class CompoundTag : public ::Tag { CompoundTag() = default; - CompoundTag(TagMap tags) : mTags(std::move(tags)) {} // NOLINT + CompoundTag(TagMap tags) : mTags(std::move(tags)) {} - CompoundTag(std::initializer_list tags) : mTags(tags) {} // NOLINT + CompoundTag(std::initializer_list tags) : mTags(tags) {} CompoundTag(CompoundTag const&) = default; CompoundTag& operator=(CompoundTag const&) = default; diff --git a/src/mc/nbt/CompoundTagVariant.h b/src/mc/nbt/CompoundTagVariant.h index 73bed7c115..a99ae6f9fa 100644 --- a/src/mc/nbt/CompoundTagVariant.h +++ b/src/mc/nbt/CompoundTagVariant.h @@ -78,7 +78,7 @@ class CompoundTagVariant { template T> [[nodiscard]] constexpr CompoundTagVariant(T tag) : mTagStorage(std::move(tag)) {} template - [[nodiscard]] constexpr CompoundTagVariant(T integer) { // NOLINT + [[nodiscard]] constexpr CompoundTagVariant(T integer) { constexpr size_t size = sizeof(T); if constexpr (size == 1) { mTagStorage = ByteTag{integer}; @@ -90,21 +90,18 @@ class CompoundTagVariant { mTagStorage = Int64Tag{integer}; } } - [[nodiscard]] inline CompoundTagVariant(std::byte b) : mTagStorage(ByteTag{b}) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(std::byte b) : mTagStorage(ByteTag{b}) {} - [[nodiscard]] inline CompoundTagVariant(float f) : mTagStorage(FloatTag{f}) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(float f) : mTagStorage(FloatTag{f}) {} - [[nodiscard]] inline CompoundTagVariant(double d) : mTagStorage(DoubleTag{d}) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(double d) : mTagStorage(DoubleTag{d}) {} - [[nodiscard]] inline CompoundTagVariant(std::string s) - : mTagStorage(std::in_place_type, std::move(s)) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(std::string s) : mTagStorage(std::in_place_type, std::move(s)) {} - [[nodiscard]] inline CompoundTagVariant(std::string_view s) - : mTagStorage(std::in_place_type, s) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(std::string_view s) : mTagStorage(std::in_place_type, s) {} template - [[nodiscard]] inline CompoundTagVariant(char const (&str)[N]) - : CompoundTagVariant(std::string_view{str, N - 1}) {} // NOLINT + [[nodiscard]] inline CompoundTagVariant(char const (&str)[N]) : CompoundTagVariant(std::string_view{str, N - 1}) {} [[nodiscard]] Tag::Type index() const noexcept { return (Tag::Type)mTagStorage.index(); } [[nodiscard]] Tag::Type getId() const noexcept { return index(); } @@ -253,7 +250,7 @@ class CompoundTagVariant { mTagStorage ); } - [[nodiscard]] operator UniqueTagPtr() const { return toUnique(); } // NOLINT + [[nodiscard]] operator UniqueTagPtr() const { return toUnique(); } [[nodiscard]] UniqueTagPtr toUnique() && { return std::visit( @@ -314,18 +311,10 @@ class CompoundTagVariant { throw std::runtime_error("tag not hold a number"); } } - [[nodiscard]] operator std::string const&() const { // NOLINT - return get(); - } - [[nodiscard]] operator std::string&() { // NOLINT - return get(); - } - [[nodiscard]] operator std::string&&() && { // NOLINT - return std::move(get()); - } - [[nodiscard]] operator std::string_view() const { // NOLINT - return get(); - } + [[nodiscard]] operator std::string const&() const { return get(); } + [[nodiscard]] operator std::string&() { return get(); } + [[nodiscard]] operator std::string&&() && { return std::move(get()); } + [[nodiscard]] operator std::string_view() const { return get(); } static CompoundTagVariant object(std::initializer_list init = {}) { return CompoundTag{init}; } diff --git a/src/mc/nbt/DoubleTag.h b/src/mc/nbt/DoubleTag.h index 949971a04c..573e4d4526 100644 --- a/src/mc/nbt/DoubleTag.h +++ b/src/mc/nbt/DoubleTag.h @@ -15,7 +15,7 @@ class DoubleTag : public ::Tag { return *this; } - [[nodiscard]] constexpr operator double() const noexcept { return data; } // NOLINT + [[nodiscard]] constexpr operator double() const noexcept { return data; } [[nodiscard]] constexpr explicit DoubleTag(double value = 0) noexcept : data(value) {} diff --git a/src/mc/nbt/FloatTag.h b/src/mc/nbt/FloatTag.h index a7d9386e2f..4c3de476e3 100644 --- a/src/mc/nbt/FloatTag.h +++ b/src/mc/nbt/FloatTag.h @@ -15,7 +15,7 @@ class FloatTag : public ::Tag { return *this; } - constexpr operator float() const noexcept { return data; } // NOLINT + constexpr operator float() const noexcept { return data; } [[nodiscard]] constexpr explicit FloatTag(float value = 0) noexcept : data(value) {} diff --git a/src/mc/nbt/IntArrayTag.h b/src/mc/nbt/IntArrayTag.h index 3625a38d72..260c4ba291 100644 --- a/src/mc/nbt/IntArrayTag.h +++ b/src/mc/nbt/IntArrayTag.h @@ -14,9 +14,9 @@ class IntArrayTag : public ::Tag, public std::vector { [[nodiscard]] constexpr IntArrayTag() = default; - [[nodiscard]] constexpr IntArrayTag(Array arr) : Array(std::move(arr)) {} // NOLINT + [[nodiscard]] constexpr IntArrayTag(Array arr) : Array(std::move(arr)) {} - [[nodiscard]] constexpr IntArrayTag(std::initializer_list val) : Array(val) {} // NOLINT + [[nodiscard]] constexpr IntArrayTag(std::initializer_list val) : Array(val) {} public: // NOLINTBEGIN diff --git a/src/mc/nbt/Tag.h b/src/mc/nbt/Tag.h index ba8bc10f4a..8da2ade625 100644 --- a/src/mc/nbt/Tag.h +++ b/src/mc/nbt/Tag.h @@ -77,7 +77,7 @@ class Tag { [[nodiscard]] bool operator==(Tag const& other) const { return equals(other); } - [[nodiscard]] operator std::unique_ptr() const { return copy(); } // NOLINT + [[nodiscard]] operator std::unique_ptr() const { return copy(); } LLNDAPI std::string toSnbt(SnbtFormat snbtFormat = SnbtFormat::PrettyFilePrint, uchar indent = 4) const noexcept; diff --git a/src/mc/platform/UUID.h b/src/mc/platform/UUID.h index 97a9a9213b..34c94c810c 100644 --- a/src/mc/platform/UUID.h +++ b/src/mc/platform/UUID.h @@ -11,9 +11,9 @@ class UUID { [[nodiscard]] constexpr UUID(uint64 a = 0, uint64 b = 0) noexcept : a(a), b(b) {} - [[nodiscard]] inline UUID(std::string const& uuidStr) : UUID(fromString(uuidStr)) {} // NOLINT + [[nodiscard]] inline UUID(std::string const& uuidStr) : UUID(fromString(uuidStr)) {} - [[nodiscard]] inline UUID(std::string_view uuidStr) : UUID(fromString(std::string{uuidStr})) {} // NOLINT + [[nodiscard]] inline UUID(std::string_view uuidStr) : UUID(fromString(std::string{uuidStr})) {} LLNDAPI static mce::UUID random(); diff --git a/src/mc/server/SimulatedPlayer.h b/src/mc/server/SimulatedPlayer.h index 81d204b057..7f2bd8c5eb 100644 --- a/src/mc/server/SimulatedPlayer.h +++ b/src/mc/server/SimulatedPlayer.h @@ -52,12 +52,12 @@ class SimulatedPlayer : public ::ServerPlayer { [[nodiscard]] inline bool simulateSneaking() { setSneaking(true); return isSneaking(); - }; + } [[nodiscard]] inline bool simulateStopSneaking() { setSneaking(false); return !isSneaking(); - }; - inline bool simulateUseItem() { return simulateUseItemInSlot(getSelectedItemSlot()); }; + } + inline bool simulateUseItem() { return simulateUseItemInSlot(getSelectedItemSlot()); } LLAPI bool simulateDestroyLookAt(float handLength = 5.5f); diff --git a/src/mc/server/commands/CommandFlag.h b/src/mc/server/commands/CommandFlag.h index ad7f0ede69..371f84fe7f 100644 --- a/src/mc/server/commands/CommandFlag.h +++ b/src/mc/server/commands/CommandFlag.h @@ -46,7 +46,7 @@ struct CommandFlag { CommandFlag() = default; - CommandFlag(CommandFlagValue value) : value(value) {} // NOLINT + CommandFlag(CommandFlagValue value) : value(value) {} [[nodiscard]] constexpr bool operator==(CommandFlag const& rhs) const noexcept { return value == rhs.value; } [[nodiscard]] constexpr bool operator!=(CommandFlag const& rhs) const noexcept { return value != rhs.value; } diff --git a/src/mc/server/commands/CommandOutputParameter.h b/src/mc/server/commands/CommandOutputParameter.h index 141ba99ffd..6bb7df8975 100644 --- a/src/mc/server/commands/CommandOutputParameter.h +++ b/src/mc/server/commands/CommandOutputParameter.h @@ -16,7 +16,7 @@ class CommandOutputParameter { std::string str; int type; - operator std::string const&() const { return str; } // NOLINT + operator std::string const&() const { return str; } public: // NOLINTBEGIN diff --git a/src/mc/util/MolangScriptArgPOD.h b/src/mc/util/MolangScriptArgPOD.h index 346c0bf137..507cd3cae7 100644 --- a/src/mc/util/MolangScriptArgPOD.h +++ b/src/mc/util/MolangScriptArgPOD.h @@ -16,14 +16,14 @@ union MolangScriptArgPOD { ActorUniqueID mActorId; ItemStackBase* mItemStackBasePtr; uint64 _mData; - constexpr MolangScriptArgPOD() : _mData(0) {}; - constexpr MolangScriptArgPOD(float val) : mFloat(val) {}; - constexpr MolangScriptArgPOD(uint64 val) : mHashType64(val) {}; - constexpr MolangScriptArgPOD(MolangLoopBreak val) : mLoopBreak(val) {}; - constexpr MolangScriptArgPOD(MolangLoopContinue val) : mLoopContinue(val) {}; - constexpr MolangScriptArgPOD(Actor const* val) : mActorPtr(const_cast(val)) {}; - constexpr MolangScriptArgPOD(ActorUniqueID val) : mActorId(val) {}; - constexpr MolangScriptArgPOD(ItemStackBase const* val) : mItemStackBasePtr(const_cast(val)) {}; - constexpr bool operator==(MolangScriptArgPOD const& rhs) const { return _mData == rhs._mData; }; - void clear() { _mData = 0; }; + constexpr MolangScriptArgPOD() : _mData(0) {} + constexpr MolangScriptArgPOD(float val) : mFloat(val) {} + constexpr MolangScriptArgPOD(uint64 val) : mHashType64(val) {} + constexpr MolangScriptArgPOD(MolangLoopBreak val) : mLoopBreak(val) {} + constexpr MolangScriptArgPOD(MolangLoopContinue val) : mLoopContinue(val) {} + constexpr MolangScriptArgPOD(Actor const* val) : mActorPtr(const_cast(val)) {} + constexpr MolangScriptArgPOD(ActorUniqueID val) : mActorId(val) {} + constexpr MolangScriptArgPOD(ItemStackBase const* val) : mItemStackBasePtr(const_cast(val)) {} + constexpr bool operator==(MolangScriptArgPOD const& rhs) const { return _mData == rhs._mData; } + void clear() { _mData = 0; } }; diff --git a/src/mc/world/actor/DataItem.h b/src/mc/world/actor/DataItem.h index 5752a53f99..bf626c2fe2 100644 --- a/src/mc/world/actor/DataItem.h +++ b/src/mc/world/actor/DataItem.h @@ -80,13 +80,13 @@ class DataItem2 : public DataItem { [[nodiscard]] std::unique_ptr clone() const override; - [[nodiscard]] constexpr T const& value() const { return mValue; }; + [[nodiscard]] constexpr T const& value() const { return mValue; } - [[nodiscard]] constexpr T& value() { return mValue; }; + [[nodiscard]] constexpr T& value() { return mValue; } - [[nodiscard]] constexpr explicit operator T const&() const { return mValue; }; + [[nodiscard]] constexpr explicit operator T const&() const { return mValue; } - [[nodiscard]] constexpr explicit operator T&() { return mValue; }; + [[nodiscard]] constexpr explicit operator T&() { return mValue; } template constexpr void setData(T2&& value) { diff --git a/src/mc/world/inventory/transaction/InventoryAction.h b/src/mc/world/inventory/transaction/InventoryAction.h index 78080d8046..9b49ac3de6 100644 --- a/src/mc/world/inventory/transaction/InventoryAction.h +++ b/src/mc/world/inventory/transaction/InventoryAction.h @@ -22,7 +22,7 @@ class InventoryAction { mToItemDescriptor(toItem) { mFromItem = fromItem; mToItem = toItem; - }; + } InventoryAction( InventorySource source, diff --git a/src/mc/world/level/Tick.h b/src/mc/world/level/Tick.h index e2b0a104c8..7f596999e9 100644 --- a/src/mc/world/level/Tick.h +++ b/src/mc/world/level/Tick.h @@ -8,13 +8,13 @@ struct Tick { Type t; - [[nodiscard]] constexpr operator Type() const noexcept { return t; } // NOLINT + [[nodiscard]] constexpr operator Type() const noexcept { return t; } - [[nodiscard]] constexpr Tick(Type v) noexcept : t(v) {}; // NOLINT + [[nodiscard]] constexpr Tick(Type v) noexcept : t(v) {} [[nodiscard]] constexpr Tick(Tick const& v) = default; - [[nodiscard]] constexpr Tick() noexcept : t(0) {}; + [[nodiscard]] constexpr Tick() noexcept : t(0) {} public: // NOLINTBEGIN diff --git a/src/mc/world/level/block/BlockVolume.h b/src/mc/world/level/block/BlockVolume.h index 43532d3224..86b57ac1cf 100644 --- a/src/mc/world/level/block/BlockVolume.h +++ b/src/mc/world/level/block/BlockVolume.h @@ -46,9 +46,9 @@ class BlockVolume { BlockVolume() = default; - Block const*& block(uint index) { return mBlocks[index]; }; + Block const*& block(uint index) { return mBlocks[index]; } - Block const*& block(BlockPos const& pos) { return mBlocks[index(pos)]; }; + Block const*& block(BlockPos const& pos) { return mBlocks[index(pos)]; } public: // NOLINTBEGIN diff --git a/src/mc/world/level/block/ComposterBlock.h b/src/mc/world/level/block/ComposterBlock.h index 5dec35c705..3e63fd70a2 100644 --- a/src/mc/world/level/block/ComposterBlock.h +++ b/src/mc/world/level/block/ComposterBlock.h @@ -32,7 +32,7 @@ class ComposterBlock : public ::BlockLegacy { virtual ~ComposterBlock() = default; // vIndex: 4 - virtual class HitResult // NOLINT + virtual class HitResult clip(class Block const& block, class BlockSource const& region, class BlockPos const& pos, class Vec3 const& A, class Vec3 const& B, ::ShapeType, class optional_ref) const; diff --git a/src/mc/world/level/levelgen/feature/gamerefs_feature/StackResultStorageFeature.h b/src/mc/world/level/levelgen/feature/gamerefs_feature/StackResultStorageFeature.h index da3ffb2d9e..c8c249b392 100644 --- a/src/mc/world/level/levelgen/feature/gamerefs_feature/StackResultStorageFeature.h +++ b/src/mc/world/level/levelgen/feature/gamerefs_feature/StackResultStorageFeature.h @@ -17,7 +17,8 @@ class StackResultStorageFeature { return nullptr; } - [[nodiscard]] inline operator bool() const { return mRegistry.has_value(); } // NOLINT + [[nodiscard]] inline operator bool() const { return mRegistry.has_value(); } + public: // prevent constructor by default StackResultStorageFeature& operator=(StackResultStorageFeature const&); diff --git a/src/mc/world/level/levelgen/structure/BoundingBox.h b/src/mc/world/level/levelgen/structure/BoundingBox.h index f97acf3ad5..895eeab717 100644 --- a/src/mc/world/level/levelgen/structure/BoundingBox.h +++ b/src/mc/world/level/levelgen/structure/BoundingBox.h @@ -68,7 +68,7 @@ class BoundingBox : public ll::math::CommutativeGroup { Vec3 max, y, g, t, z, b, p; }; - [[nodiscard]] constexpr AABB() noexcept : min(0), max(0) {}; - [[nodiscard]] constexpr AABB(class AABB const& k) noexcept : min(k.min), max(k.max) {}; - [[nodiscard]] constexpr AABB(class Vec3 const& min, class Vec3 const& max) noexcept : min(min), max(max) {}; + [[nodiscard]] constexpr AABB() noexcept : min(0), max(0) {} + [[nodiscard]] constexpr AABB(class AABB const& k) noexcept : min(k.min), max(k.max) {} + [[nodiscard]] constexpr AABB(class Vec3 const& min, class Vec3 const& max) noexcept : min(min), max(max) {} inline AABB& merge(AABB const& a) noexcept { *this = AABB{ll::math::min(a.min, min), ll::math::max(a.max, max)};