Skip to content

Commit d5d1cbb

Browse files
committed
fix some lint
1 parent 226baf9 commit d5d1cbb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/ruis/util/key.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,18 @@ namespace {
169169
struct key_name_key_pair {
170170
std::string_view name;
171171
ruis::key key;
172+
173+
// This constructor is added to suppress clang-tidy to ask using designated initializers,
174+
// when constructing key_name_key_pair items in the array, because it looks clearer without them.
175+
constexpr key_name_key_pair(std::string_view name, ruis::key key) :
176+
name(name),
177+
key(key)
178+
{}
172179
};
173180

174181
constexpr auto key_name_to_key_ordered_mapping = []() constexpr {
175-
// TODO: refactor to avoid listing key names again
182+
// utki::enum_array is used here just to set the array size to the number of keys in ruis::key enum,
183+
// so that we can be sure that all keys are listed in the mapping.
176184
utki::enum_array<key_name_key_pair, ruis::key> arr = {{{
177185
{"space"sv, ruis::key::space},
178186
{"enter"sv, ruis::key::enter},

0 commit comments

Comments
 (0)