From d9e1d2269605bdd9e95aedece3da8138c0137be0 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Wed, 27 Nov 2024 09:22:32 -0800 Subject: [PATCH] clang-tidy: fixes error in common::Cleanup class (#37377) part of #28566 Signed-off-by: Takeshi Yoneda --- envoy/common/execution_context.h | 2 +- source/common/common/cleanup.h | 4 ++-- test/common/common/execution_context_test.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/envoy/common/execution_context.h b/envoy/common/execution_context.h index dada24e31697..fbe312bdc03e 100644 --- a/envoy/common/execution_context.h +++ b/envoy/common/execution_context.h @@ -115,7 +115,7 @@ class ScopedExecutionContext : NonCopyable { [execution_context = ExecutionContext::fromStreamInfo(trackedStream), \ scoped_object = (scopedObject)] { \ if (execution_context == nullptr) { \ - return Envoy::Cleanup::Noop(); \ + return Envoy::Cleanup::noop(); \ } \ return execution_context->onScopeEnter(scoped_object); \ }() diff --git a/source/common/common/cleanup.h b/source/common/common/cleanup.h index bdefb1cbb29f..103465abf82c 100644 --- a/source/common/common/cleanup.h +++ b/source/common/common/cleanup.h @@ -24,8 +24,8 @@ class Cleanup { bool cancelled() { return cancelled_; } - static Cleanup Noop() { - return Cleanup([] {}); + static Cleanup noop() { + return {[]() {}}; } private: diff --git a/test/common/common/execution_context_test.cc b/test/common/common/execution_context_test.cc index 66dd126ce4aa..c2a6757631f6 100644 --- a/test/common/common/execution_context_test.cc +++ b/test/common/common/execution_context_test.cc @@ -22,11 +22,11 @@ thread_local const Http::FilterContext* current_filter_context = nullptr; class TestExecutionContext : public ExecutionContext { public: - Envoy::Cleanup onScopeEnter(Envoy::Tracing::Span*) override { return Envoy::Cleanup::Noop(); } + Envoy::Cleanup onScopeEnter(Envoy::Tracing::Span*) override { return Envoy::Cleanup::noop(); } Envoy::Cleanup onScopeEnter(const Http::FilterContext* filter_context) override { if (filter_context == nullptr) { - return Envoy::Cleanup::Noop(); + return Envoy::Cleanup::noop(); } const Http::FilterContext* old_filter_context = current_filter_context; current_filter_context = filter_context;