Skip to content

Commit 1e226b9

Browse files
committed
fix clang-tidy noexcept issues
1 parent f36dd73 commit 1e226b9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

include/libcyphal/application/node/heartbeat_producer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class HeartbeatProducer final // NOSONAR cpp:S3624
169169
void publishMessage(const TimePoint approx_now)
170170
{
171171
// Publishing of heartbeats makes sense only if the local node ID is known.
172-
if (presentation_.transport().getLocalNodeId() == cetl::nullopt)
172+
if (!presentation_.transport().getLocalNodeId().has_value())
173173
{
174174
return;
175175
}

include/libcyphal/presentation/client.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Client final : public detail::ClientBase
243243
{
244244
return TooManyPendingRequestsError{};
245245
}
246-
const auto transfer_id = opt_transfer_id.value();
246+
const auto transfer_id = *opt_transfer_id;
247247

248248
// Create and register a response promise object, which will be used to handle the response.
249249
// Its done specifically before sending the request, so that we will be ready to handle a response
@@ -331,7 +331,7 @@ class RawServiceClient final : public detail::ClientBase
331331
{
332332
return TooManyPendingRequestsError{};
333333
}
334-
const auto transfer_id = opt_transfer_id.value();
334+
const auto transfer_id = *opt_transfer_id;
335335

336336
// 2. Create and register a response promise object, which will be used to handle the response.
337337
// Its done specifically before sending the request, so that we will be ready to handle a response

include/libcyphal/presentation/publisher_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PublisherImpl final : public common::cavl::Node<PublisherImpl>,
5454
{
5555
if (const auto local_node_id = delegate.getLocalNodeId())
5656
{
57-
const SessionSpec session_spec{subject_id_, local_node_id.value()};
57+
const SessionSpec session_spec{subject_id_, *local_node_id};
5858
next_transfer_id_ = transfer_id_map->getIdFor(session_spec);
5959
}
6060
}
@@ -108,7 +108,7 @@ class PublisherImpl final : public common::cavl::Node<PublisherImpl>,
108108
{
109109
if (const auto local_node_id = delegate_.getLocalNodeId())
110110
{
111-
const SessionSpec session_spec{subject_id_, local_node_id.value()};
111+
const SessionSpec session_spec{subject_id_, *local_node_id};
112112
transfer_id_map->setIdFor(session_spec, next_transfer_id_);
113113
}
114114
}

include/libcyphal/transport/can/can_transport_impl.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,11 @@ class TransportImpl final : private TransportDelegate, public ICanTransport
564564
return;
565565
}
566566
const auto& pop_success = cetl::get<IMedia::PopResult::Success>(pop_result);
567-
if (!pop_success.has_value())
567+
if (!pop_success)
568568
{
569569
return;
570570
}
571-
572-
const IMedia::PopResult::Metadata& pop_meta = pop_success.value();
571+
const IMedia::PopResult::Metadata& pop_meta = *pop_success;
573572

574573
const auto timestamp_us =
575574
std::chrono::duration_cast<std::chrono::microseconds>(pop_meta.timestamp.time_since_epoch());

0 commit comments

Comments
 (0)