Skip to content

Commit b88232a

Browse files
author
Mauro Passerino
committed
Clang-tidy fix: Break for loop after moving unique_ptr
Clang-tidy thinks this moved message can still be used in future iterations of the for loop, so we break after move it. Signed-off-by: Mauro Passerino <[email protected]>
1 parent 245e350 commit b88232a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rclcpp/include/rclcpp/experimental/intra_process_manager.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,8 @@ class IntraProcessManager
926926
if (std::next(it) == subscription_ids.end()) {
927927
// If this is the last subscription, give up ownership
928928
subscription->provide_intra_process_data(std::move(message));
929+
// Nothing else to do
930+
break;
929931
} else {
930932
// Copy the message since we have additional subscriptions to serve
931933
Deleter deleter = message.get_deleter();
@@ -965,6 +967,8 @@ class IntraProcessManager
965967
if (std::next(it) == subscription_ids.end()) {
966968
// If this is the last subscription, give up ownership
967969
ros_message_subscription->provide_intra_process_message(std::move(message));
970+
// Nothing else to do
971+
break;
968972
} else {
969973
// Copy the message since we have additional subscriptions to serve
970974
Deleter deleter = message.get_deleter();

0 commit comments

Comments
 (0)