From 438b51970308d00b76fabf26927a62a694be537e Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Thu, 1 Dec 2022 16:26:41 +0000 Subject: [PATCH] Apply clang-tidy feedback --- src/io/notifier.hpp | 9 ++++++--- src/io/transport.hpp | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/io/notifier.hpp b/src/io/notifier.hpp index e6b073046..81d6507bb 100644 --- a/src/io/notifier.hpp +++ b/src/io/notifier.hpp @@ -11,6 +11,10 @@ #pragma once +#include +#include +#include + namespace memgraph::io { class ReadinessToken { @@ -30,7 +34,6 @@ class Inner { void Notify(ReadinessToken readiness_token) { { std::unique_lock lock(mu_); - spdlog::trace("Notifier notifying token {}", readiness_token.GetId()); ready_.emplace_back(readiness_token); } // mutex dropped @@ -61,9 +64,9 @@ class Notifier { Notifier &operator=(Notifier &&old) = default; ~Notifier() = default; - void Notify(ReadinessToken readiness_token) { inner_->Notify(readiness_token); } + void Notify(ReadinessToken readiness_token) const { inner_->Notify(readiness_token); } - ReadinessToken Await() { return inner_->Await(); } + ReadinessToken Await() const { return inner_->Await(); } }; } // namespace memgraph::io diff --git a/src/io/transport.hpp b/src/io/transport.hpp index 2c2e79060..5dd7a9a39 100644 --- a/src/io/transport.hpp +++ b/src/io/transport.hpp @@ -107,7 +107,7 @@ class Io { ReadinessToken readiness_token) { const Duration timeout = default_timeout_; const Address from_address = address_; - std::function fill_notifier = std::bind(&Notifier::Notify, notifier, readiness_token); + std::function fill_notifier = [notifier, readiness_token]() { notifier.Notify(readiness_token); }; return implementation_.template Request(to_address, from_address, std::move(request), fill_notifier, timeout); } @@ -117,7 +117,7 @@ class Io { ResponseFuture RequestWithNotificationAndTimeout(Address to_address, RequestT request, Notifier notifier, ReadinessToken readiness_token, Duration timeout) { const Address from_address = address_; - std::function fill_notifier = std::bind(&Notifier::Notify, notifier, readiness_token); + std::function fill_notifier = [notifier, readiness_token]() { notifier.Notify(readiness_token); }; return implementation_.template Request(to_address, from_address, std::move(request), fill_notifier, timeout); }