Skip to content

Commit 4f2660d

Browse files
authored
cleanup(otel): suppress maybe unitialized warning (googleapis#14343)
* cleanup(otel): suppress maybe unitialized warning * address review comments
1 parent 29b8a83 commit 4f2660d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

google/cloud/internal/opentelemetry.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ bool TracingEnabled(Options const& options);
242242
template <typename Rep, typename Period>
243243
std::function<void(std::chrono::duration<Rep, Period>)> MakeTracedSleeper(
244244
Options const& options,
245-
std::function<void(std::chrono::duration<Rep, Period>)> const& sleeper,
245+
std::function<void(std::chrono::duration<Rep, Period>)> sleeper,
246246
std::string const& name) {
247247
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
248248
if (TracingEnabled(options)) {
249-
return [=](std::chrono::duration<Rep, Period> d) {
249+
return [name, sleeper = std::move(sleeper)](
250+
std::chrono::duration<Rep, Period> d) {
250251
// A sleep of 0 is not an interesting event worth tracing.
251252
if (d == std::chrono::duration<Rep, Period>::zero()) return sleeper(d);
252253
auto span = MakeSpan(name);

0 commit comments

Comments
 (0)