Skip to content

Commit

Permalink
Address some issues found by sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
TrentHouliston committed Sep 16, 2023
1 parent 0b78e29 commit 21b6096
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dsl/operation/ChronoTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace dsl {
ChronoTask(std::function<bool(NUClear::clock::time_point&)>&& task,
NUClear::clock::time_point time,
uint64_t id)
: task(task), time(time), id(id) {}
: task(std::move(task)), time(time), id(id) {}

/**
* @brief Run the task and return true if the time has been updated to run again
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Last.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace dsl {

LastItemStorage() : list() {}

LastItemStorage(T&& data) : list({data}) {}
LastItemStorage(T&& data) : list({std::move(data)}) {}

template <typename Output>
operator std::list<Output>() const {
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace dsl {
NetworkData() : std::shared_ptr<T>() {}
NetworkData(T* ptr) : std::shared_ptr<T>(ptr) {}
NetworkData(const std::shared_ptr<T>& ptr) : std::shared_ptr<T>(ptr) {}
NetworkData(std::shared_ptr<T>&& ptr) : std::shared_ptr<T>(ptr) {}
NetworkData(std::shared_ptr<T>&& ptr) : std::shared_ptr<T>(std::move(ptr)) {}
};

struct NetworkSource {
Expand Down
5 changes: 4 additions & 1 deletion src/threading/Reaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ namespace threading {
std::atomic<uint64_t> Reaction::reaction_id_source(0); // NOLINT

Reaction::Reaction(Reactor& reactor, ReactionIdentifiers&& identifiers, TaskGenerator&& generator)
: reactor(reactor), identifiers(identifiers), id(++reaction_id_source), generator(generator) {}
: reactor(reactor)
, identifiers(std::move(identifiers))
, id(++reaction_id_source)
, generator(std::move(generator)) {}

void Reaction::unbind() {
// Unbind
Expand Down
2 changes: 1 addition & 1 deletion src/threading/ReactionTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace threading {
, emit_stats(parent.emit_stats && (current_task != nullptr ? current_task->emit_stats : true))
, group_descriptor(group_descriptor)
, thread_pool_descriptor(thread_pool_descriptor)
, callback(callback) {}
, callback(std::move(callback)) {}


/**
Expand Down

0 comments on commit 21b6096

Please sign in to comment.