From 21a6d1b044f835d372e1ebcf5a5dc570093273b2 Mon Sep 17 00:00:00 2001 From: Jakob Gamper <97gamjak@gmail.com> Date: Sat, 22 Aug 2026 01:28:30 +0200 Subject: [PATCH 1/3] make enum clang-tidy conform with too short names --- include/mstd/enum.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/mstd/enum.hpp b/include/mstd/enum.hpp index 0ace569..4273bc9 100644 --- a/include/mstd/enum.hpp +++ b/include/mstd/enum.hpp @@ -79,41 +79,41 @@ static constexpr auto begin() { return values.begin(); } \ static constexpr auto end() { return values.end(); } \ \ - static constexpr std::string_view name(EnumName e) \ + static constexpr std::string_view name(EnumName enum) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == e) \ + if (values.at(i) == enum) \ return names.at(i); \ return {}; \ } \ \ - static constexpr std::string toString(EnumName e) \ + static constexpr std::string toString(EnumName enum) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == e) \ + if (values.at(i) == enum) \ return std::string(names.at(i)); \ return {}; \ } \ \ static constexpr std::optional from_string( \ - std::string_view s \ + std::string_view str \ ) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (names.at(i) == s) \ + if (names.at(i) == str) \ return values.at(i); \ return std::nullopt; \ } \ \ - static constexpr underlying_type to_underlying(EnumName e) \ + static constexpr underlying_type to_underlying(EnumName enum) \ { \ - return static_cast(e); \ + return static_cast(enum); \ } \ \ - static constexpr std::optional index(EnumName e) \ + static constexpr std::optional index(EnumName enum) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == e) \ + if (values.at(i) == enum) \ return i; \ return std::nullopt; \ } \ From 6d4ea209f9caad9478d8f00525dc03b83113b22c Mon Sep 17 00:00:00 2001 From: Jakob Gamper <97gamjak@gmail.com> Date: Sat, 22 Aug 2026 17:52:28 +0200 Subject: [PATCH 2/3] fix not using reserved name enum for parameters --- include/mstd/enum.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/mstd/enum.hpp b/include/mstd/enum.hpp index 4273bc9..15af4e1 100644 --- a/include/mstd/enum.hpp +++ b/include/mstd/enum.hpp @@ -79,18 +79,18 @@ static constexpr auto begin() { return values.begin(); } \ static constexpr auto end() { return values.end(); } \ \ - static constexpr std::string_view name(EnumName enum) \ + static constexpr std::string_view name(EnumName enum_) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == enum) \ + if (values.at(i) == enum_) \ return names.at(i); \ return {}; \ } \ \ - static constexpr std::string toString(EnumName enum) \ + static constexpr std::string toString(EnumName enum_) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == enum) \ + if (values.at(i) == enum_) \ return std::string(names.at(i)); \ return {}; \ } \ @@ -105,15 +105,15 @@ return std::nullopt; \ } \ \ - static constexpr underlying_type to_underlying(EnumName enum) \ + static constexpr underlying_type to_underlying(EnumName enum_) \ { \ - return static_cast(enum); \ + return static_cast(enum_); \ } \ \ - static constexpr std::optional index(EnumName enum) \ + static constexpr std::optional index(EnumName enum_) \ { \ for (std::size_t i = 0; i < size; ++i) \ - if (values.at(i) == enum) \ + if (values.at(i) == enum_) \ return i; \ return std::nullopt; \ } \ From 6779ea10b1f79706115c84d2fa9f4b6193437928 Mon Sep 17 00:00:00 2001 From: Jakob Gamper <97gamjak@gmail.com> Date: Sat, 22 Aug 2026 17:54:23 +0200 Subject: [PATCH 3/3] changelog: add entry for making mstd enum type clang-tidy conform --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d86e3ba..7a37b6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## Next Release +### Enum + +- make mstd enum type clang-tidy conform + ## [0.2.1](https://github.com/repo/owner/releases/tag/0.2.1) - 2026-08-19