modernization: tweaks for c++20

Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-21 14:12:33 +03:00
committed by Seth Ladygo
parent 502c9cd67b
commit 86464cd083
40 changed files with 155 additions and 166 deletions

View File

@ -224,12 +224,12 @@ MessagePart::looks_like_attachment() const noexcept
static void
test_cooked_full()
{
std::array<std::pair<std::string, std::string>, 4> cases = {{
auto cases = std::to_array<std::pair<std::string, std::string>>({
{ "/hello/world/foo", "foo" },
{ "foo:/\n/bar", "bar"},
{ "Aap Noot Mies", "Aap-Noot-Mies"},
{ "..", "-"}
}};
});
for (auto&& test: cases)
assert_equal(cook_full(test.first), test.second);
@ -238,12 +238,12 @@ test_cooked_full()
static void
test_cooked_minimal()
{
std::array<std::pair<std::string, std::string>, 4> cases = {{
auto cases = std::to_array<std::pair<std::string, std::string>>({
{ "/hello/world/foo", "foo" },
{ "foo:/\n/bar", "bar"},
{ "Aap Noot Mies.doc", "Aap Noot Mies.doc"},
{ "..", "-"}
}};
});
for (auto&& test: cases)
assert_equal(cook_minimal(test.first), test.second);