Skip to content

Commit

Permalink
style: Address nodiscard warning reported by MSVC's analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Tradias committed Sep 6, 2022
1 parent 0699034 commit 2f92f7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/agrpc/detail/repeatedly_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ struct BasicRepeatedlyRequestInitiator

if (is_stop_possible)
{
operation->cancellation_context().template emplace<detail::RepeatedlyRequestCancellationFunction>(
stop_token);
auto& context = operation->cancellation_context();
context.template emplace<detail::RepeatedlyRequestCancellationFunction>(stop_token);
}
detail::StartWorkAndGuard guard{grpc_context};
detail::initiate_repeatedly_request(grpc_context, *operation);
Expand Down
22 changes: 8 additions & 14 deletions src/agrpc/detail/repeatedly_request_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,24 @@ class RepeatedlyRequestOperationBase
{
}

[[nodiscard]] auto& cancellation_context() noexcept { return impl2.second(); }
auto& cancellation_context() noexcept { return impl2.second(); }

[[nodiscard]] auto& completion_handler() noexcept { return impl1.second(); }
auto& completion_handler() noexcept { return impl1.second(); }

[[nodiscard]] decltype(auto) get_allocator() noexcept
{
return detail::exec::get_allocator(this->request_handler());
}
decltype(auto) get_allocator() noexcept { return detail::exec::get_allocator(this->request_handler()); }

protected:
[[nodiscard]] bool is_stopped() const noexcept { return impl2.second().is_stopped(); }

[[nodiscard]] decltype(auto) get_executor() noexcept { return detail::exec::get_executor(this->request_handler()); }
decltype(auto) get_executor() noexcept { return detail::exec::get_executor(this->request_handler()); }

[[nodiscard]] agrpc::GrpcContext& grpc_context() noexcept
{
return detail::query_grpc_context(this->get_executor());
}
agrpc::GrpcContext& grpc_context() noexcept { return detail::query_grpc_context(this->get_executor()); }

[[nodiscard]] RPC rpc() noexcept { return impl2.first(); }
RPC rpc() noexcept { return impl2.first(); }

[[nodiscard]] Service& service() noexcept { return impl1.first(); }
Service& service() noexcept { return impl1.first(); }

[[nodiscard]] RequestHandler& request_handler() noexcept { return request_handler_; }
RequestHandler& request_handler() noexcept { return request_handler_; }

private:
detail::CompressedPair<Service&, CompletionHandler> impl1;
Expand Down

0 comments on commit 2f92f7f

Please sign in to comment.