Skip to content

Commit 781aef1

Browse files
committed
refactor: fix linter errors
1 parent 1643544 commit 781aef1

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

.clang-tidy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Checks: "*,
3131
-bugprone-easily-swappable-parameters,
3232
-misc-non-private-member-variables-in-classes,
3333
-llvm-header-guard,
34-
35-
-misc-include-cleaner"
34+
"
3635
CheckOptions:
3736
cppcoreguidelines-pro-type-member-init.IgnoreArrays: true
3837
readability-implicit-bool-conversion.AllowPointerConditions: true

src/handlers/cooking_planning/view.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void handleCookingPlanningCQ(
7272
state.availability |
7373
transform([](const auto& ia) { return SelectableIngredient{{ia.ingredient.id, ia.ingredient.name}}; }) |
7474
to<std::vector>();
75-
std::optional<api::StorageId> theOnlyStorage = getTheOnlyStorage(state);
75+
const std::optional<api::StorageId> theOnlyStorage = getTheOnlyStorage(state);
7676
renderIngredientsSpending(ingredients, theOnlyStorage.has_value(), userId, chatId, bot);
7777
CookingIngredientsSpending newState{
7878
.prevState = std::move(state), .storageId = theOnlyStorage, .ingredients = std::move(ingredients)};

src/handlers/recipes_suggestions/view.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
#include "render/main_menu/view.hpp"
99
#include "render/recipes_suggestions/view.hpp"
1010
#include "render/storage/view.hpp"
11-
#include "render/storages_selection/view.hpp"
1211
#include "utils/ingredients_availability.hpp"
1312
#include "utils/parsing.hpp"
1413

1514
#include <optional>
1615
#include <stdexcept>
1716
#include <string>
17+
#include <string_view>
1818
#include <utility>
1919
#include <variant>
2020
#include <vector>
2121

2222
namespace cookcookhnya::handlers::recipes_suggestions {
2323

2424
using namespace render::recipes_suggestions;
25-
using namespace render::select_storages;
2625
using namespace render::storage;
2726
using namespace render::cooking_planning;
2827
using namespace render::main_menu;
2928
using namespace api::models::storage;
3029
using namespace std::views;
30+
using namespace std::literals;
3131

3232
void handleSuggestedRecipesListCQ(
3333
SuggestedRecipesList& state, CallbackQueryRef cq, BotRef bot, SMRef stateManager, api::ApiClientRef api) {
@@ -56,16 +56,18 @@ void handleSuggestedRecipesListCQ(
5656
}
5757

5858
if (data.starts_with("recipe_")) {
59-
auto recipeId = utils::parseSafe<api::RecipeId>(data.substr(sizeof("recipe_") - 1));
59+
auto recipeId = utils::parseSafe<api::RecipeId>(std::string_view{data}.substr("recipe_"sv.size()));
6060
if (!recipeId)
6161
return;
6262

6363
std::vector<CookingPlanning::IngredientAvailability> inStorage =
6464
utils::inStoragesAvailability(state.getStorageIds(), *recipeId, userId, api);
6565

6666
renderCookingPlanning(inStorage, *recipeId, userId, chatId, bot, api);
67-
stateManager.put(CookingPlanning{
68-
.prevState = std::move(state), .addedStorages = {}, .availability = inStorage, .recipeId = *recipeId});
67+
stateManager.put(CookingPlanning{.prevState = std::move(state),
68+
.addedStorages = {},
69+
.availability = std::move(inStorage),
70+
.recipeId = *recipeId});
6971
return;
7072
}
7173

0 commit comments

Comments
 (0)