🧹 gucc: refactor with clang-tidy

This commit is contained in:
Vladislav Nepogodin 2024-07-29 00:42:58 +04:00
parent eefb1ae1be
commit 4c23dccdcf
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 20 additions and 20 deletions

View File

@ -25,14 +25,14 @@ using namespace std::string_view_literals;
#define CONV_OPT_F(needle, f, default_val) \ #define CONV_OPT_F(needle, f, default_val) \
if (line.starts_with(needle)) { \ if (line.starts_with(needle)) { \
if (f) { \ if (f) { \
return fmt::format(needle "{}", *f); \ return fmt::format(needle "{}", *(f)); \
} \ } \
return {"#" needle default_val}; \ return {"#" needle default_val}; \
} }
#define CONV_OPT_F_S(needle, f, default_val) \ #define CONV_OPT_F_S(needle, f, default_val) \
if (line.starts_with(needle)) { \ if (line.starts_with(needle)) { \
if (f) { \ if (f) { \
return fmt::format(needle "\"{}\"", *f); \ return fmt::format(needle "\"{}\"", *(f)); \
} \ } \
return {"#" needle "\"" default_val "\""}; \ return {"#" needle "\"" default_val "\""}; \
} }
@ -43,7 +43,7 @@ using namespace std::string_view_literals;
#define CONV_OPT_B(needle, f, default_val) \ #define CONV_OPT_B(needle, f, default_val) \
if (line.starts_with(needle)) { \ if (line.starts_with(needle)) { \
if (f) { \ if (f) { \
return fmt::format(needle "{}", convert_boolean_val(needle, *f)); \ return fmt::format(needle "{}", convert_boolean_val(needle, *(f))); \
} \ } \
return {"#" needle default_val}; \ return {"#" needle default_val}; \
} }

View File

@ -44,7 +44,7 @@ auto parse_desktop_profiles(std::string_view config_content) noexcept -> std::op
std::vector<DesktopProfile> desktop_profiles{}; std::vector<DesktopProfile> desktop_profiles{};
auto desktop_table = netprof_table["desktop"].as_table(); const auto* desktop_table = netprof_table["desktop"].as_table();
for (auto&& [key, value] : *desktop_table) { for (auto&& [key, value] : *desktop_table) {
auto value_table = *value.as_table(); auto value_table = *value.as_table();
std::vector<std::string> desktop_profile_packages{}; std::vector<std::string> desktop_profile_packages{};
@ -69,7 +69,7 @@ auto parse_net_profiles(std::string_view config_content) noexcept -> std::option
parse_toml_array(netprof_table["base-packages"]["desktop"]["packages"].as_array(), net_profiles.base_profiles.base_desktop_packages); parse_toml_array(netprof_table["base-packages"]["desktop"]["packages"].as_array(), net_profiles.base_profiles.base_desktop_packages);
// parse desktop // parse desktop
auto desktop_table = netprof_table["desktop"].as_table(); const auto* desktop_table = netprof_table["desktop"].as_table();
for (auto&& [key, value] : *desktop_table) { for (auto&& [key, value] : *desktop_table) {
auto value_table = *value.as_table(); auto value_table = *value.as_table();
std::vector<std::string> desktop_profile_packages{}; std::vector<std::string> desktop_profile_packages{};