Skip to content

Commit cca5fa8

Browse files
committed
fix(commands): improve lambda capture in GetKeysFromCommand for clarity
1 parent 9cf6a9a commit cca5fa8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/commands/commander.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ StatusOr<std::vector<int>> CommandTable::GetKeysFromCommand(const CommandAttribu
194194
std::vector<int> key_indexes;
195195

196196
attributes->ForEachKeyRange(
197-
[&](const std::vector<std::string> &, CommandKeyRange key_range) {
198-
key_range.ForEachKeyIndex([&](int i) { key_indexes.push_back(i); }, cmd_tokens.size());
197+
[&key_indexes, &cmd_tokens](const std::vector<std::string> &, CommandKeyRange key_range) {
198+
key_range.ForEachKeyIndex([&key_indexes](int i) { key_indexes.push_back(i); }, cmd_tokens.size());
199199
},
200-
cmd_tokens, [&](const auto &) { has_key_args = false; });
200+
cmd_tokens, [&has_key_args](const auto &) { has_key_args = false; });
201201

202202
if (!has_key_args) {
203203
return {Status::NotOK, "The command has no key arguments"};

0 commit comments

Comments
 (0)