Skip to content

Commit 37fed81

Browse files
committed
fix: addressing cppcheck warnings
1 parent b1e59fb commit 37fed81

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

include/Ark/Utils/Logger.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Ark::internal
7474
* @param args
7575
*/
7676
template <typename... Args>
77-
void debug(const Logger::MessageAndLocation data, Args&&... args)
77+
void debug(const Logger::MessageAndLocation& data, Args&&... args)
7878
{
7979
if (shouldDebug())
8080
fmt::println(

src/arkreactor/VM/VM.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,7 @@ namespace Ark
370370
}
371371

372372
if (ctx == nullptr)
373-
{
374-
m_execution_contexts.push_back(std::make_unique<ExecutionContext>());
375-
ctx = m_execution_contexts.back().get();
376-
}
373+
ctx = m_execution_contexts.emplace_back(std::make_unique<ExecutionContext>()).get();
377374

378375
assert(!ctx->primary && "The new context shouldn't be marked as primary!");
379376
assert(ctx != m_execution_contexts.front().get() && "The new context isn't really new!");

src/arkreactor/VM/Value/Dict.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ namespace Ark::internal
3232
{
3333
std::vector<Value> keys;
3434
keys.reserve(m_dict.size());
35+
std::ranges::copy(std::ranges::views::keys(m_dict), std::back_inserter(keys));
3536

36-
for (auto&& key : std::ranges::views::keys(m_dict))
37-
keys.push_back(key);
3837
return keys;
3938
}
4039

0 commit comments

Comments
 (0)