Suggested code improvements

This commit is contained in:
CrisMystik 2022-04-25 21:34:43 +02:00 committed by John Preston
parent 3a021f4e49
commit fafbbb4996
1 changed files with 3 additions and 3 deletions

View File

@ -448,7 +448,7 @@ bool ResolveSettings(
controller->window().activate();
const auto section = match->captured(1).mid(1).toLower();
const auto getSectionType = [&]() -> std::optional<::Settings::Type> {
const auto type = [&]() -> std::optional<::Settings::Type> {
if (section.isEmpty()) {
return ::Settings::Main::Id();
} else if (section == qstr("language")) {
@ -466,9 +466,9 @@ bool ResolveSettings(
return ::Settings::ChangePhone::Id();
}
return {};
};
}();
if (const auto type = getSectionType()) {
if (type.has_value()) {
controller->showSettings(*type);
controller->window().activate();
}