Skip to content

Commit 32ad080

Browse files
committed
fix some lint
1 parent a3bbb7c commit 32ad080

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/ruis/resource_loader.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121

2222
#include "resource_loader.hpp"
2323

24+
#include <algorithm>
25+
#include <ranges>
26+
2427
#include <fsif/root_dir.hpp>
2528
#include <fsif/util.hpp>
2629

@@ -110,10 +113,11 @@ std::shared_ptr<resource> resource_loader::res_pack_entry::find_in_cache(std::st
110113

111114
const tml::forest* resource_loader::res_pack_entry::find_resource_in_script(std::string_view id) const
112115
{
113-
auto j = std::find(
114-
this->script.begin(), //
115-
this->script.end(),
116-
id
116+
auto j = std::ranges::find_if(
117+
this->script, //
118+
[&](const auto& n) {
119+
return n.value.string == id;
120+
}
117121
);
118122
if (j != this->script.end()) {
119123
utki::assert(j->value.string == id, SL);

src/ruis/style/styled.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ class styled
156156
value(std::move(value))
157157
{}
158158

159-
template <
160-
std::convertible_to<actual_value_type> convertible_type //
161-
>
159+
template <std::convertible_to<actual_value_type> convertible_type //
160+
>
162161
styled(convertible_type conv) :
163162
value(actual_value_type(conv))
164163
{}

src/ruis/util/key.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ std::string_view ruis::to_string(ruis::key key)
167167

168168
namespace {
169169
struct key_name_key_pair {
170-
std::string_view first;
171-
ruis::key second;
170+
std::string_view name;
171+
ruis::key key;
172172
};
173173

174174
constexpr auto key_name_to_key_ordered_mapping = []() constexpr {
@@ -271,9 +271,13 @@ constexpr auto key_name_to_key_ordered_mapping = []() constexpr {
271271
{"f15"sv, ruis::key::f15},
272272
}}};
273273

274-
utki::sort(arr.begin(), arr.end(), [](const auto& a, const auto& b) {
275-
return a.first < b.first;
276-
});
274+
utki::sort(
275+
arr.begin(), //
276+
arr.end(),
277+
[](const auto& a, const auto& b) {
278+
return a.name < b.name;
279+
}
280+
);
277281
return arr;
278282
}();
279283
} // namespace
@@ -285,11 +289,11 @@ ruis::key ruis::to_key(std::string_view name)
285289
key_name_to_key_ordered_mapping.end(),
286290
name,
287291
[](const auto& a, const std::string_view& b) {
288-
return a.first < b;
292+
return a.name < b;
289293
}
290294
);
291-
if (i != key_name_to_key_ordered_mapping.end() && i->first == name) {
292-
return i->second;
295+
if (i != key_name_to_key_ordered_mapping.end() && i->name == name) {
296+
return i->key;
293297
}
294298
return ruis::key::unknown;
295299
}

0 commit comments

Comments
 (0)